Re: [protobuf] can protobuf cost less bytes?

2014-10-20 Thread 'Feng Xiao' via Protocol Buffers
On Sun, Oct 19, 2014 at 6:58 AM, Aijing Sun aijings...@gmail.com wrote: 1.if a int value is -1,then through varint 128 serialze is 10 bytes. 2. a bool true is none 0,and false is 0,but it cost 1 byte . I hope -1 just cost 1 byte,and bool cost no byte. and it can cost less byte when serialize

Re: [protobuf] can protobuf cost less bytes?

2014-10-20 Thread Ilia Mirkin
I believe you're looking for zigzag encoding wrt negatives. If instead of int32 you call it sint32, that should get a much better encoding for small negative values. On Sun, Oct 19, 2014 at 9:58 AM, Aijing Sun aijings...@gmail.com wrote: 1.if a int value is -1,then through varint 128 serialze is