Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for nextPowerOfTwo (0.17 sec)

  1. guava/src/com/google/common/math/BigIntegerMath.java

        // Check for the next power of two boundary, to save us a CLZ operation.
        int nextPowerOfTwo = 1 << (bits - 1);
    
        // Iteratively multiply the longs as big as they can go.
        for (long num = startingNumber; num <= n; num++) {
          // Check to see if the floor(log2(num)) + 1 has changed.
          if ((num & nextPowerOfTwo) != 0) {
            nextPowerOfTwo <<= 1;
            bits++;
          }
          // Get rid of the 2s in num.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 17:21:56 UTC 2024
    - 18.8K bytes
    - Viewed (0)
Back to top