3 ms·
> (key[31]&63)|64 You confused me here; this looks like you're clearing the highest bit and then setting the highest bit... in a 7-bit integer. Of course it ma
by thaumasiotes 5y ago
> (key[31]&63)|64
You confused me here; this looks like you're clearing the highest bit and then setting the highest bit... in a 7-bit integer. Of course it makes more sense that you're clearing the two highest bits and then setting the second-highest bit of an 8-bit integer, which is indeed the same thing as clearing the highest bit and then setting the second-highest bit.
But why have you written it to fiddle the second-highest bit twice? Why not just write `(key[31]&127)|64`?
(And then of course, why not use the hexadecimal form of your bitfield constants so people can tell what's going on? No need to count bits that way.)
- nullc 5y agojust because 63 was a shorter constant to type than 127. Hex would have been longer due to the prefix. :P
- emj 5y agoThank you for that self analyzing! I got lost on that part, so will now stop writing ping 127.1 just to save four bytes. I've always felt that people learnt things by seeing that, but now I know I'm too lazy to bother learning myself.