summaryrefslogtreecommitdiff
path: root/pbstream.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-02-06 14:30:03 -0800
committerJoshua Haberman <joshua@reverberate.org>2009-02-06 14:30:03 -0800
commitb98433ce8c1f12c432b55195fb6a57d67d2635c4 (patch)
treebbeb48f6c0a22572650edc282af29dbe9d23b438 /pbstream.c
parent5fb04a8ba51cdc09c357e97c945afbad2769f0d3 (diff)
Implementations for ZigZag decoding.
Diffstat (limited to 'pbstream.c')
-rw-r--r--pbstream.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pbstream.c b/pbstream.c
index c300153..4112a7c 100644
--- a/pbstream.c
+++ b/pbstream.c
@@ -102,14 +102,14 @@ bool get_64_le(char **buf, char *end, uint64_t *out_value)
return PBSTREAM_STATUS_OK;
}
-int32_t zigzag_decode_32(uint64_t src)
+int32_t zigzag_decode_32(uint64_t n)
{
- return 0; /* TODO */
+ return (n >> 1) ^ -(int32_t)(n & 1);
}
-int64_t zigzag_decode_64(uint64_t src)
+int64_t zigzag_decode_64(uint64_t n)
{
- return 0; /* TODO */
+ return (n >> 1) ^ (int64_t)(n & 1);
}
/* Parses the next field-number/wire-value pair from the stream of bytes
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback