buffer.writeFlexUInt(2)
buffer.writeFixedIntOrUInt(bits, 2)
This pattern recurs frequently. I wonder if it would be (marginally) faster to have a method variant that does both in one step.
Originally posted by @tgregg in #1133 (comment)
E.g.:
buffer.writeFixedIntWithLengthPrefix(2, bits)
or:
buffer.writeFixedIntWithLengthPrefix2(bits)
Although, we may see some benefit just from having constants for more FlexUInt values. E.g.:
buffer.writeByte(FlexInt.TWO)
buffer.writeFixedInt2(bits)