I think this is a speed vs. memory type question. (Updated with MrSmith42s suggestion):
If you really want speed I would define a mask for each bit a compare that. Perhaps something like:
const uint8_t BitMask[] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 };
/* Find out if LSB is set */
if( hash & BitMask[0] ) { ... }
The problem with shifts is that it uses an instruction per shift whereas a fixed mask will only have a single memory acces before the comparison.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…