From 4667ed4be921b2142321e47c8ccc6a35a9189277 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 6 Feb 2011 08:21:47 -0800 Subject: All tests pass again, valgrind-clean! Next up: benchmarks. --- stream/upb_decoder.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'stream/upb_decoder.c') diff --git a/stream/upb_decoder.c b/stream/upb_decoder.c index b85abb9..588d553 100644 --- a/stream/upb_decoder.c +++ b/stream/upb_decoder.c @@ -26,11 +26,12 @@ INLINE bool upb_decode_varint_fast(const char **ptr, uint64_t *val, b = *(p++); low |= (b & 0x7f) << 14; if(!(b & 0x80)) goto done; b = *(p++); low |= (b & 0x7f) << 21; if(!(b & 0x80)) goto done; b = *(p++); low |= (b & 0x7f) << 28; - high = (b & 0x7f) >> 3; if(!(b & 0x80)) goto done; - b = *(p++); high |= (b & 0x7f) << 4; if(!(b & 0x80)) goto done; - b = *(p++); high |= (b & 0x7f) << 11; if(!(b & 0x80)) goto done; - b = *(p++); high |= (b & 0x7f) << 18; if(!(b & 0x80)) goto done; - b = *(p++); high |= (b & 0x7f) << 25; if(!(b & 0x80)) goto done; + high = (b & 0x7f) >> 4; if(!(b & 0x80)) goto done; + b = *(p++); high |= (b & 0x7f) << 3; if(!(b & 0x80)) goto done; + b = *(p++); high |= (b & 0x7f) << 10; if(!(b & 0x80)) goto done; + b = *(p++); high |= (b & 0x7f) << 17; if(!(b & 0x80)) goto done; + b = *(p++); high |= (b & 0x7f) << 24; if(!(b & 0x80)) goto done; + b = *(p++); high |= (b & 0x7f) << 31; if(!(b & 0x80)) goto done; upb_seterr(status, UPB_ERROR, "Unterminated varint"); return false; -- cgit v1.2.3