summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-04-02 20:59:01 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-04-02 21:07:30 +0300
commit99434724d0375280abe44944b0c39f45991f26df (patch)
tree687d5e7a8771f09dacd08dfc433259bfb59a15f7 /pb_encode.c
parent6c90e824c4e8f54c71645b63b1ea33b1e028cb97 (diff)
Fix splint warnings, add splint test case
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pb_encode.c b/pb_encode.c
index 59e6f2a7..a5851582 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -405,9 +405,9 @@ bool checkreturn pb_encode_svarint(pb_ostream_t *stream, int64_t value)
{
uint64_t zigzagged;
if (value < 0)
- zigzagged = (uint64_t)(~(value << 1));
+ zigzagged = ~((uint64_t)value << 1);
else
- zigzagged = (uint64_t)(value << 1);
+ zigzagged = (uint64_t)value << 1;
return pb_encode_varint(stream, zigzagged);
}
@@ -448,7 +448,7 @@ bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value)
bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number)
{
- uint64_t tag = wiretype | (field_number << 3);
+ uint64_t tag = ((uint64_t)field_number << 3) | wiretype;
return pb_encode_varint(stream, tag);
}