https://developers.google.com/protocol-buffers/docs/encoding#signed-integers

This is all documented. Please read the docs.

On Sat, Sep 5, 2015 at 11:08 PM, TheAceInfinity <aceofs...@gmail.com> wrote:
> I wrote these helper macros for s types:
> #define encode_sint32(n) (((n) << 1) ^ ((n) >> 31))
> #define encode_sint64(n) (((n) << 1) ^ ((n) >> 63))
>
> Do you have any information on how to go about decoding the bytes if my
> original type was sint32 or sint64?
>
> On Saturday, September 5, 2015 at 7:41:05 PM UTC-6, Ilia Mirkin wrote:
>>
>> On Sat, Sep 5, 2015 at 9:36 PM, TheAceInfinity <aceo...@gmail.com> wrote:
>> > If I know that the bytes are a type of varint from a byte stream, is
>> > there
>> > then no way to determine whether the 150 should be calculated and
>> > interpreted as an int32 or an sint32?
>>
>> Nope, no information beyond the wire type. Also no way to tell the
>> difference between, say, a string or a submessage, since those are
>> both just length-delimited fields.
>>
>> > That's my question. What exactly is the TAG ID for?
>>
>> To tell which field is which.

-- 
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.

Reply via email to