fmoo / python-varint

A basic varint implementation in python
MIT License
34 stars 8 forks source link

Encoding negative numbers makes the program stall #6

Open jw2476 opened 4 years ago

jw2476 commented 4 years ago

Using varint.encode(-1) makes the program indefinitely stall. Is this expected behaviour, because I really need to be able to write negative varints.

w1nte commented 4 years ago

I faced the same problem. According to the wikipedia article about Variable-length quanitity only unsigned integers are defined in the basic implementation. So you need another variant of varint like ZigZag encoding.