addthis / stream-lib

Stream summarizer and cardinality estimator.
Apache License 2.0
2.26k stars 556 forks source link

Varint bug #77

Closed larroy closed 10 years ago

larroy commented 10 years ago

if (i > 63) is not correct, should be 70

The max number of bytes in a 64 bit varint is 10.

tea-dragon commented 10 years ago

I think you are confused. Understandable since the methods are so densely written. The tenth byte never enters the while loop, and is set during the return. If you look at the bit shift logic, for instance, you can see that allowing indexes higher than 63 would wipe the entire value.