3 ms·
I implied that a useful serialization format would include integers of multiple size. When your field only needs a uint16, you don't want to pay the extra 6 byt
by majewsky 9y ago
I implied that a useful serialization format would include integers of multiple size. When your field only needs a uint16, you don't want to pay the extra 6 bytes to encode as, say, uint64.
- pegasuscollins 9y agoYou could either stipulate (as you suggested) to always use the smallest width that still fits a number and then prefix with a length byte but that would be wasteful. Ideally something like LEB128 would be used. At any rate, it's not an issue in terms of guaranteeing a bijective mapping.
- majewsky 9y agoNice, I didn't know about LEB128.