Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for ceilingPowerOfTwo (0.3 sec)

  1. android/guava-tests/test/com/google/common/math/IntMathTest.java

        for (int x : POSITIVE_INTEGER_CANDIDATES) {
          BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
          if (fitsInInt(expectedResult)) {
            assertEquals(expectedResult.intValue(), IntMath.ceilingPowerOfTwo(x));
          } else {
            try {
              IntMath.ceilingPowerOfTwo(x);
              fail("Expected ArithmeticException");
            } catch (ArithmeticException expected) {
            }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 24.5K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/math/LongMathTest.java

        for (long x : POSITIVE_LONG_CANDIDATES) {
          BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
          if (fitsInLong(expectedResult)) {
            assertEquals(expectedResult.longValue(), LongMath.ceilingPowerOfTwo(x));
          } else {
            try {
              LongMath.ceilingPowerOfTwo(x);
              fail("Expected ArithmeticException");
            } catch (ArithmeticException expected) {
            }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/math/LongMathTest.java

        for (long x : POSITIVE_LONG_CANDIDATES) {
          BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
          if (fitsInLong(expectedResult)) {
            assertEquals(expectedResult.longValue(), LongMath.ceilingPowerOfTwo(x));
          } else {
            try {
              LongMath.ceilingPowerOfTwo(x);
              fail("Expected ArithmeticException");
            } catch (ArithmeticException expected) {
            }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java

    @GwtCompatible(emulated = true)
    public class BigIntegerMathTest extends TestCase {
      public void testCeilingPowerOfTwo() {
        for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
          BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) >= 0);
          assertTrue(result.compareTo(x.add(x)) < 0);
        }
      }
    
      public void testFloorPowerOfTwo() {
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Fri May 17 17:58:33 UTC 2024
    - 27.8K bytes
    - Viewed (0)
  5. guava/src/com/google/common/math/IntMath.java

       *     int}, i.e. when {@code x > 2^30}
       * @since 20.0
       */
      public static int ceilingPowerOfTwo(int x) {
        checkPositive("x", x);
        if (x > MAX_SIGNED_POWER_OF_TWO) {
          throw new ArithmeticException("ceilingPowerOfTwo(" + x + ") not representable as an int");
        }
        return 1 << -Integer.numberOfLeadingZeros(x - 1);
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/math/IntMath.java

       *     int}, i.e. when {@code x > 2^30}
       * @since 20.0
       */
      public static int ceilingPowerOfTwo(int x) {
        checkPositive("x", x);
        if (x > MAX_SIGNED_POWER_OF_TWO) {
          throw new ArithmeticException("ceilingPowerOfTwo(" + x + ") not representable as an int");
        }
        return 1 << -Integer.numberOfLeadingZeros(x - 1);
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  7. guava/src/com/google/common/math/BigIntegerMath.java

       * {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
       *
       * @throws IllegalArgumentException if {@code x <= 0}
       * @since 20.0
       */
      public static BigInteger ceilingPowerOfTwo(BigInteger x) {
        return BigInteger.ZERO.setBit(log2(x, CEILING));
      }
    
      /**
       * Returns the largest power of two less than or equal to {@code x}. This is equivalent to {@code
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 18.9K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/math/BigIntegerMath.java

       * {@code BigInteger.valueOf(2).pow(log2(x, CEILING))}.
       *
       * @throws IllegalArgumentException if {@code x <= 0}
       * @since 20.0
       */
      public static BigInteger ceilingPowerOfTwo(BigInteger x) {
        return BigInteger.ZERO.setBit(log2(x, CEILING));
      }
    
      /**
       * Returns the largest power of two less than or equal to {@code x}. This is equivalent to {@code
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 18.9K bytes
    - Viewed (0)
  9. guava/src/com/google/common/math/LongMath.java

       *     long}, i.e. when {@code x > 2^62}
       * @since 20.0
       */
      public static long ceilingPowerOfTwo(long x) {
        checkPositive("x", x);
        if (x > MAX_SIGNED_POWER_OF_TWO) {
          throw new ArithmeticException("ceilingPowerOfTwo(" + x + ") is not representable as a long");
        }
        return 1L << -Long.numberOfLeadingZeros(x - 1);
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/math/LongMath.java

       *     long}, i.e. when {@code x > 2^62}
       * @since 20.0
       */
      public static long ceilingPowerOfTwo(long x) {
        checkPositive("x", x);
        if (x > MAX_SIGNED_POWER_OF_TWO) {
          throw new ArithmeticException("ceilingPowerOfTwo(" + x + ") is not representable as a long");
        }
        return 1L << -Long.numberOfLeadingZeros(x - 1);
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
Back to top