encodePackedFixed32Field function
Encode a packed repeated fixed32 field (wire type 2): tag + varint(total_len) + concatenated 4-byte little-endian values.
Used for repeated fixed32/sfixed32/float fields.
Proto3 rule: does not emit anything if values is empty.
Returns buffer with the field bytes appended.
Implementation
List<int> encodePackedFixed32Field(
List<int> buffer,
int fieldNumber,
List<int> values,
) {
if (values.isEmpty) return buffer;
List<int> temp = [];
for (int i = 0; i < values.length; i++) {
encodeFixed32(temp, values[i]);
}
encodeTag(buffer, fieldNumber, _wireTypeLEN);
encodeBytes(buffer, temp);
return buffer;
}