atMostOneBitIsSet()
[Bit-twiddling Functions]

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 atMostOneBitIsSet (unsigned char v)
bool atMostOneBitIsSet (unsigned short v)
bool atMostOneBitIsSet (unsigned int v)
bool atMostOneBitIsSet (unsigned long v)
bool atMostOneBitIsSet (unsigned long long v)
bool atMostOneBitIsSet (signed char v)
bool atMostOneBitIsSet (char v)
bool atMostOneBitIsSet (short v)
bool atMostOneBitIsSet (int v)
bool atMostOneBitIsSet (long v)
bool 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 ( long long  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( long  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( int  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( short  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( char  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( signed char  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( unsigned long long  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( unsigned long  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( unsigned int  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( unsigned short  v  )  [inline]
bool SimTK::atMostOneBitIsSet ( unsigned char  v  )  [inline]

Generated on Wed Dec 30 11:05:08 2009 for SimTKcore by  doxygen 1.6.1