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