5
32-bit
tag = (field_number << 3) | 5. Followed by exactly 4 bytes little-endian.
Wire type 5 (32-bit) encodes exactly 4 bytes in little-endian order. Used for fixed32, sfixed32, and float fields. When you know values fit in 32 bits, wire type 5 avoids varint overhead for values > 2^28.
Used For
fixed32sfixed32float
Encoding Details
Wire type 5 always reads exactly 4 bytes following the tag. The bytes are in little-endian order.
Field types using wire type 5: fixed32: unsigned 32-bit integer, always 4 bytes sfixed32: signed 32-bit integer, always 4 bytes, two's complement float: IEEE 754 single-precision floating-point, 4 bytes
Tag for wire type 5: tag = (field_number << 3) | 5 Field 1 with wire type 5: 0x0d
Note: wire type numbers 3 and 4 (start-group and end-group) are deprecated and should not be used in new schemas.
Examples
| Label | Hex | Explanation |
|---|---|---|
| float 1.0, field 1 | 0d 00 00 80 3f | Tag 0x0d = field 1, wire 5. Value: IEEE 754 float 1.0 = 0x3F800000 little-endian. |
| fixed32 256, field 1 | 0d 00 01 00 00 | Tag 0x0d. Value 256 = 0x00000100 little-endian. |