Skip to content
  • Mauritz Sundell's avatar
    9b680e7d
    ndb - reversed bit scanning · 9b680e7d
    Mauritz Sundell authored
    The BitmaskImpl class had functions for finding
    the least significant bit set in word and array
    of words (ffs(), find_first(), find_next()).
    
    Now functions for finding also the most significant set bit
    are added.
    
    fls() - find most significant bit in Uint32, index 0-31
    ctz() - count trailing (least sign.) zeros, equal to ffs()
    clz() - count leading (most sign.) zeros. That is the
            number of bits preceding the most significant set
            bit. That is: fls(x) + clz(x) = 31 if x!=0.
    
    All these function are undefined for zero words.
    
    find_last() and find_prev() are added to find the most 
    significant set bits in an array of words, corresponding
    to find_first() and find_next().
    
    find_last()/find_prev() allows one bit outside word array,
    better would probably be to exclude the given start bit,
    but that would mean update all current uses of find_last().
    9b680e7d
    ndb - reversed bit scanning
    Mauritz Sundell authored
    The BitmaskImpl class had functions for finding
    the least significant bit set in word and array
    of words (ffs(), find_first(), find_next()).
    
    Now functions for finding also the most significant set bit
    are added.
    
    fls() - find most significant bit in Uint32, index 0-31
    ctz() - count trailing (least sign.) zeros, equal to ffs()
    clz() - count leading (most sign.) zeros. That is the
            number of bits preceding the most significant set
            bit. That is: fls(x) + clz(x) = 31 if x!=0.
    
    All these function are undefined for zero words.
    
    find_last() and find_prev() are added to find the most 
    significant set bits in an array of words, corresponding
    to find_first() and find_next().
    
    find_last()/find_prev() allows one bit outside word array,
    better would probably be to exclude the given start bit,
    but that would mean update all current uses of find_last().
Loading