4 ms·
At some point you forget a zero and it all goes to hell. Using 1 << n is far more concise.
by astrodust 10y ago
At some point you forget a zero and it all goes to hell. Using 1 << n is far more concise.
- bryondowd 10y agoProbably true. But assuming they are aligned, as they should be, a missing 0 would be pretty obvious. The real gotcha would be accidentally leaving a character in the wrong column during a copy-paste job. But really, I've only used this with two or three character hex codes, so it works out much better. 0x01 through 0x80 are pretty hard to mess up, and 0x001 through 0x800 isn't bad either. But yeah, the bit shifting honestly is probably a better solution. Cleaner, more scale-able.