protocol buffers - Is there one-byte type in protobuf? -
i can't find if there possible have char / byte type in proto.
i can see various types here:
- https://developers.google.com/protocol-buffers/docs/proto
- https://developers.google.com/protocol-buffers/docs/encoding
but can't find byte type , int16 types there.
no, there no fixed 1-byte type. fixed length has 4 , 8 byte variants only. other numeric values encoded "varint"s, variable length depending on magnitude (and sign, "zigzag" comes play there). can store bytes value 0-127 in 1 byte, , 128-255 in 2 bytes. 16-bit values take between 1 , 3 bytes depending on magnitude (and sign /zigzag etc).
for multiples, there "bytes" 8-bit version, , "packed" rest; avoids cost of field-header per value.
Comments
Post a Comment