Re: [protobuf] int32 negative numbers

2010-03-21 Thread Adam Kwintkiewicz
... for a negative number, the resulting varint is *always ten bytes long ...* I didn't saw that part. Thanx 2010/3/21 Evan Jones ev...@mit.edu On Mar 21, 2010, at 8:46 , adamdms wrote: I am wonder why int32 field (with negative value) has 10 bytes? 10 - field No 2, wire type 0 FD FF FF FF

Re: [protobuf] int32 negative numbers

2010-03-21 Thread Henner Zeller
On Sun, Mar 21, 2010 at 08:05, Adam Kwintkiewicz adam.kwintkiew...@gmail.com wrote: ... for a negative number, the resulting varint is always ten bytes long ... Reason for that is the varint encoding: it only encodes the bits that are set in an integer. For small positive values that results in

Re: [protobuf] int32 negative numbers

2010-03-21 Thread Adam Kwintkiewicz
Thank you for your reply. Yes you are right. I just wondered why int32 consists of 10 bits, rather than a maximum of 5 (in the case of large or negative numbers). Adam 2010/3/21 Henner Zeller henner.zel...@googlemail.com On Sun, Mar 21, 2010 at 08:05, Adam Kwintkiewicz

Re: [protobuf] int32 negative numbers

2010-03-21 Thread Kenton Varda
On Sun, Mar 21, 2010 at 8:54 AM, Adam Kwintkiewicz adam.kwintkiew...@gmail.com wrote: Thank you for your reply. Yes you are right. I just wondered why int32 consists of 10 bits, rather than a maximum of 5 (in the case of large or negative numbers). So that you can change an int32 to int64