Simbody  3.6

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

◆ atMostOneBitIsSet() [1/11]

bool SimTK::atMostOneBitIsSet ( unsigned char  v)
inline

◆ atMostOneBitIsSet() [2/11]

bool SimTK::atMostOneBitIsSet ( unsigned short  v)
inline

◆ atMostOneBitIsSet() [3/11]

bool SimTK::atMostOneBitIsSet ( unsigned int  v)
inline

◆ atMostOneBitIsSet() [4/11]

bool SimTK::atMostOneBitIsSet ( unsigned long  v)
inline

◆ atMostOneBitIsSet() [5/11]

bool SimTK::atMostOneBitIsSet ( unsigned long long  v)
inline

◆ atMostOneBitIsSet() [6/11]

bool SimTK::atMostOneBitIsSet ( signed char  v)
inline

◆ atMostOneBitIsSet() [7/11]

bool SimTK::atMostOneBitIsSet ( char  v)
inline

◆ atMostOneBitIsSet() [8/11]

bool SimTK::atMostOneBitIsSet ( short  v)
inline

◆ atMostOneBitIsSet() [9/11]

bool SimTK::atMostOneBitIsSet ( int  v)
inline

◆ atMostOneBitIsSet() [10/11]

bool SimTK::atMostOneBitIsSet ( long  v)
inline

◆ atMostOneBitIsSet() [11/11]

bool SimTK::atMostOneBitIsSet ( long long  v)
inline