Ejemplo n.º 1
0
 public static int FindPreviousPositivePowerOfTwo(int value)
 {
     unchecked
     {
         return(1 << (31 - IntUtil.NumberOfLeadingZeros(value)));
     }
 }
Ejemplo n.º 2
0
 public static int FindNextPositivePowerOfTwo(int value)
 {
     unchecked
     {
         return(1 << (32 - IntUtil.NumberOfLeadingZeros(value - 1)));
     }
 }