Simbody  3.5

atMostOneBitIsSet(i) provides an extremely fast way to determine whether an integral type is either zero or consists of a single set bit. More...

Functions

bool SimTK::atMostOneBitIsSet (unsigned char v)
 
bool SimTK::atMostOneBitIsSet (unsigned short v)
 
bool SimTK::atMostOneBitIsSet (unsigned int v)
 
bool SimTK::atMostOneBitIsSet (unsigned long v)
 
bool SimTK::atMostOneBitIsSet (unsigned long long v)
 
bool SimTK::atMostOneBitIsSet (signed char v)
 
bool SimTK::atMostOneBitIsSet (char v)
 
bool SimTK::atMostOneBitIsSet (short v)
 
bool SimTK::atMostOneBitIsSet (int v)
 
bool SimTK::atMostOneBitIsSet (long v)
 
bool SimTK::atMostOneBitIsSet (long long v)
 

Detailed Description

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.

See also
exactlyOneBitIsSet()

Function Documentation

bool SimTK::atMostOneBitIsSet ( unsigned char  v)
inline
bool SimTK::atMostOneBitIsSet ( unsigned short  v)
inline
bool SimTK::atMostOneBitIsSet ( unsigned int  v)
inline
bool SimTK::atMostOneBitIsSet ( unsigned long  v)
inline
bool SimTK::atMostOneBitIsSet ( unsigned long long  v)
inline
bool SimTK::atMostOneBitIsSet ( signed char  v)
inline
bool SimTK::atMostOneBitIsSet ( char  v)
inline
bool SimTK::atMostOneBitIsSet ( short  v)
inline
bool SimTK::atMostOneBitIsSet ( int  v)
inline
bool SimTK::atMostOneBitIsSet ( long  v)
inline
bool SimTK::atMostOneBitIsSet ( long long  v)
inline