thank you for your explanation Ilia Mirkin於 2014年7月25日星期五UTC+8上午7時41分57秒寫道: > > On Thu, Jul 24, 2014 at 7:38 PM, ching lu <[email protected] <javascript:>> > wrote: > > Previous example is not good > > > > mssage { > > > > required bool x1 = 1; > > required bool x2 = 2; > > required bool x3 = 3; > > required bool x4 = 4; > > required bool x5 = 5; > > required bool x6 = 6; > > required bool x7 = 7; > > required bool x8 = 8; > > required bool x9 = 9; > > required bool x10 = 10; > > required bool x11 = 11; > > required bool x12 = 12; > > required bool x13 = 13; > > required bool x14 = 14; > > required bool x15 = 15; > > optional bool y = 16; > > > > } > > > > will it take 16 byte or 16 bit for the message? There is no > documentation > > for the behaviour of bit field > > AFAIK there's no boolean wire type, so they're just varints that > happen to only take on 0/1 values (and provide the appropriate > language bindings). So 16 bytes. > > And that's because your field id's are < 16. Once you go over 16, > it'll be 2 bytes per field (i.e. the tag will take up a full byte, and > then the value will be another byte). > > -ilia >
-- 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 http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
