3 ms·
IIRC you store (23 - size) in the last byte in "small string" mode, so when the size gets to 23, the last byte is 0, doubling as the null terminator.
by edflsafoiewq 7y ago
IIRC you store (23 - size) in the last byte in "small string" mode, so when the size gets to 23, the last byte is 0, doubling as the null terminator.
- lilyball 7y agoSurely it must be (23 - size) << 1, otherwise you won't guarantee a 0 in the LSB.
- edflsafoiewq 7y agoIf you use the LSB of the last byte for a flag, you're using the 56th bit of one of the {data,size,cap} words. I'd use the MSB in this case, since you can shift that off easier.
- SamReidHughes 7y agoOn little endian systems it uses two MSb's, on big endian systems it uses two LSb's. There are actually two flag bits.