Re: [protobuf] Zig Zag Encoding (vs two's complement encoding)

2011-01-14 Thread David Srbecky
126 is 0111 1110 in binary. We truncate it form the left to groups of seven: 000 110 and then encode it as usual (least significant group first): 1 110 0 000. It takes two bytes to encode, but so does the zig-zag encoding. In fact, the zig-zag encoding and the two's co

[protobuf] Re: Zig Zag Encoding

2011-01-14 Thread David Srbecky
126 is 0111 1110 in binary. We truncate it form the left to groups of seven: 000 110 and then encode it as usual (least significant group first): 1 110 0 000. It takes two bytes to encode, but so does the zig-zag encoding. In fact, the zig-zag encoding and the two's co

[protobuf] custom constructor

2011-01-14 Thread Tim Wisniewski
I am interested in encoding a java.util.BitSet within a .proto file as a hex string. Is there a way to put some custom serialization code into the proto file so that it handles the conversion for me. I want to avoid losing the code if I rerun the compiler. The reason for this is that I can't fin

Re: [protobuf] custom constructor

2011-01-14 Thread Evan Jones
On Jan 14, 2011, at 9:22 , Tim Wisniewski wrote: The reason for this is that I can't find a bitset type within the proto language. Any thoughts? This is not possible because the intention is that the .proto file will be portable between many different languages, so it only supports fairly