예제 #1
0
 public static int FindPreviousPositivePowerOfTwo(int value)
 {
     unchecked
     {
         return(1 << (31 - IntUtil.NumberOfLeadingZeros(value)));
     }
 }
예제 #2
0
 public static int FindNextPositivePowerOfTwo(int value)
 {
     unchecked
     {
         return(1 << (32 - IntUtil.NumberOfLeadingZeros(value - 1)));
     }
 }