Commit e2d45cbe authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy

protobuf-c.c: Fix undefined code in zigzag functions

parent 565f42d3
...@@ -311,9 +311,9 @@ static inline uint32_t ...@@ -311,9 +311,9 @@ static inline uint32_t
zigzag32(int32_t v) zigzag32(int32_t v)
{ {
if (v < 0) if (v < 0)
return ((uint32_t) (-v)) * 2 - 1; return (-(uint32_t)v) * 2 - 1;
else else
return v * 2; return (uint32_t)(v) * 2;
} }
/** /**
...@@ -376,9 +376,9 @@ static inline uint64_t ...@@ -376,9 +376,9 @@ static inline uint64_t
zigzag64(int64_t v) zigzag64(int64_t v)
{ {
if (v < 0) if (v < 0)
return ((uint64_t) (-v)) * 2 - 1; return (-(uint64_t)v) * 2 - 1;
else else
return v * 2; return (uint64_t)(v) * 2;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment