apps/matlab/slots.c
uint32_t NumberOfBits(uint32_t n) {
    uint32_t count = 0;
    while (n) {
        n &= (n-1);
        count++;
    }
    return count;
}
/**
 * Help function to calculate the number of active slots within a bitmask
 *
 * @param n bitfield to count bits within
 * @return number of set bits
 */
Help function to calculate the number of active slots within a bitmask
@param n bitfield to count bits within
@return number of set bits
Help function to calculate the number of active slots within a bitmask @param n bitfield to count bits within @return number of set bits
uint32_t NumberOfBits(uint32_t n) {
    uint32_t count = 0;
    while (n) {
        n &= (n-1);
        count++;
    }
    return count;
}
uint32_t NumberOfBits ( uint32_t n ) { uint32_t count = 0 ; while ( n ) { n &= ( n - 1 ) ; count ++ ; } return count ; }
Help function to calculate the number of active slots within a bitmask
 @param n bitfield to count bits within
 @return number of set bits
Help function to calculate the number of active slots within a bitmask @param n bitfield to count bits within @return number of set bits