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