When you AND two values together, every bit that wasn't 1 in *both* values is set to zero. So if you want to check if a certain bit is set, you AND that one bit to a value, and then see if the result is 0 (the bit wasn't present), or if the result is the same what you AND'd.
if( (10110 & 10000) == 10000 )
if( (value & mask) == mask )
You can drop the " == mask " part because, in C++, non-zero integers automaticly convert to 'true':
if(value & mask) //If the result is 00000, then the statement evaluates to false, otherwise it evaluates to true.
Hodgeman's func does the same thing, but also uses an index to create the mask by shifting the value 00000001 over N places to become (for example) 00010000.