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
 and I suggest change wire type:
 0(000) --- positive varint
 1(001) --- negative  varint
 2(010)  true
 3(011)  false
 4(100)  bit32
 5(101)  bit64
 6(110)  Length-delimited

Such a wire-incompatible change is never going to happen in protobuf...






  --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to protobuf+unsubscr...@googlegroups.com.
 To post to this group, send email to protobuf@googlegroups.com.
 Visit this group at http://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


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 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
 and I suggest change wire type:
 0(000) --- positive varint
 1(001) --- negative  varint
 2(010)  true
 3(011)  false
 4(100)  bit32
 5(101)  bit64
 6(110)  Length-delimited




 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to protobuf+unsubscr...@googlegroups.com.
 To post to this group, send email to protobuf@googlegroups.com.
 Visit this group at http://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.