Re:Add extra stuff to a “standard” encoding? Sure, why not
by jchw on Wednesday September 20, 2023 @07:00PM
(#37591212)
Ah, I was a little unclear. I mean ~0 as in NOT 0, an integer with all bits set. This is also the same as -1 in two's compliment. So basically, I'm suggesting you use the maximum unsigned integer value as a sentinel. That doesn't work if you're using a variable-length unsigned integer like base128vlq, but if you're doing base128vlq you could always make a special sentinel for that (e.g. unnecessarily set the high bit and follow it with a zero byte; this would never normally appear with a base128vlq.)
I thought -0 is only something in floating point numbers, not integers, and using floats for the length of a message sounds like a nightmare to me.