encodeSfixed32Field function
Encodes an sfixed32 field (wire type 5) into buffer.
Proto3 rule: if value is 0, nothing is written.
The signed 32-bit value is serialized identically to fixed32 on the
wire — the sign is preserved in the two's-complement bit pattern and the
4-byte little-endian encoding is the same.
Returns the same buffer list, possibly with bytes appended.
Implementation
List<int> encodeSfixed32Field(List<int> buffer, int fieldNumber, int value) {
if (value == 0) return buffer;
encodeTag(buffer, fieldNumber, 5);
encodeFixed32(buffer, value);
return buffer;
}