apps/matlab/slots.c
static uint32_t BitPosition(uint32_t n) {
    
    uint32_t count = 0;
    assert(n && (! (n & (n-1)) )); // single bit set

    while (n){
        n = n >> 1;
        ++count; // position of bit within bitfield
    }
    return count;
}
/**
 * Help function to calculate the position of active slots within a bitmask
 *
 * @param n bitfield to count bits within
 * @return number of set bits
 */
Help function to calculate the position of active slots within a bitmask
@param n bitfield to count bits within
@return number of set bits
Help function to calculate the position of active slots within a bitmask @param n bitfield to count bits within @return number of set bits
static uint32_t BitPosition(uint32_t n) {
    uint32_t count = 0;
    assert(n && (! (n & (n-1)) )); 
    while (n){
        n = n >> 1;
        ++count; 
    }
    return count;
}
static uint32_t BitPosition ( uint32_t n ) { uint32_t count = 0 ; assert ( n && ( ! ( n & ( n - 1 ) ) ) ) ; while ( n ) { n = n >> 1 ; ++ count ; } return count ; }
Help function to calculate the position of active slots within a bitmask
 @param n bitfield to count bits within
 @return number of set bits
Help function to calculate the position of active slots within a bitmask @param n bitfield to count bits within @return number of set bits
// single bit set // position of bit within bitfield