3 ms·
> Storing those 4 values takes ~29 bits. Just storing those 4 values in 4 bits is more efficient. Checking that a bit is set is also a simple AND + CMP. Which
by Danieru 12y ago
> Storing those 4 values takes ~29 bits.
Just storing those 4 values in 4 bits is more efficient.
Checking that a bit is set is also a simple AND + CMP. Which beats out a DIV + CMP.
Sorry I just had not considered this isn't common knowledge outside C or C++ land.
- Thrymr 12y ago> Just storing those 4 values in 4 bits is more efficient. That doesn't really work for version numbers > 1. They're not just flags.
- njr123 12y agoHow do you store a version number in a single bit?
- rjaco31 12y agoWell the bit n represents the version n, if this bit is at 1, this version is supported, otherwise it's not.
- ajuc 12y agoA few bits per value (depending how big you predict they will get). One bit per value means you can only increment version of each function once :)