I think you must be referring to the example on varint encoding here: https://developers.google.com/protocol-buffers/docs/encoding I believe the example is correct; it's just that the ++ represents a concatenation instead of an addition. Each byte has 7 bits for storing the number (since the remaining bit is used to indicate whether there are more bytes), and so we are concatenating them to get the full 14 bits of the actual number. Note also that the five leading zeros are omitted.
On Thu, Sep 22, 2016 at 1:35 AM, <[email protected]> wrote: > 1. 000 0010 010 1100 > 2. → 000 0010 ++ 010 1100 > 3. → 100101100 > 4. → 256 + 32 + 8 + 4 = 300 > > i have a doubt > > 000 0010 ++ 010 1100 = 1 0010 1100, should not 010 1110 ? > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
