Yup, actually I got it wrong................ (field_number << 3) | wire_type represents how to encode/generate Key and not how to decode it....... in the next line it has been written as "right-shift field number"...... which makes things clear....
Sorry again.... for the mess up... Varun On Aug 28, 11:49 am, Marc Gravell <marc.grav...@gmail.com> wrote: > (d'oh; replied to wrong address...) > > I'm fairly sure that << 3 is correct; if it was >> 3, then 3 bits of > field_number would be lost, and the next 3 would overlap with wire_type. > I did notice an error in the language document though - a missing semicolon > relating to imports, IIRC... > > Marc > > 2009/8/28 VarunGoyal <goyalvarun....@gmail.com> > > > > > > > Dear All, > > > There is documentation bug in Encoding Section > > >http://code.google.com/apis/protocolbuffers/docs/encoding.html > > > In the topic "Message Structure", see the lines > > > Each key in the streamed message is a varint with the value > > (field_number << 3) | wire_type – in other words, the last three bits > > of the number store the wire type. > > > Here, > > > (field_number << 3) should be (field_number >> 3) > > > Regards, > > > Varun Goyal > > -- > Regards, > > Marc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---