| 
    Simbody
    3.8
    
   | 
 
atMostOneBitIsSet(i) provides an extremely fast way to determine whether an integral type is either zero or consists of a single set bit.
atMostOneBitIsSet(i) provides an extremely fast way to determine whether an integral type is either zero or consists of a single set bit.
This question arises when using bits to represent set membership where one may wish to verify that an integer represents a single element rather than a set of elements.