src/kernel/bitmanip.h
// Round up to the nearest power of two
// Find the least power of 2 greater than or equal to an integer

Round up to the nearest power of two
Find the least power of 2 greater than or equal to an integer
Round up to the nearest power of two Find the least power of 2 greater than or equal to an integer
inline static uint32 RoundUpPow2(uint32 value)
    {
      value = value - 1; 
      value = value | (value >> 1); 
      value = value | (value >> 2); 
      value = value | (value >> 4); 
      value = value | (value >> 8); 
      value = value | (value >>16); 
      return value + 1; 
    }
inline static uint32 RoundUpPow2 ( uint32 value ) { value = value - 1 ; value = value | ( value >> 1 ) ; value = value | ( value >> 2 ) ; value = value | ( value >> 4 ) ; value = value | ( value >> 8 ) ; value = value | ( value >> 16 ) ; return value + 1 ; }
Round up to the nearest power of two
Find the least power of 2 greater than or equal to an integer
Round up to the nearest power of two Find the least power of 2 greater than or equal to an integer