Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 14 of 14 for isPowerOfTwo (0.61 sec)

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

          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) >= 0);
          assertTrue(result.compareTo(x.add(x)) < 0);
        }
      }
    
      public void testFloorPowerOfTwo() {
        for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
          BigInteger result = BigIntegerMath.floorPowerOfTwo(x);
          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) <= 0);
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.2K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/math/BigIntegerMath.java

        int logFloor = x.bitLength() - 1;
        switch (mode) {
          case UNNECESSARY:
            checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through
          case DOWN:
          case FLOOR:
            return logFloor;
    
          case UP:
          case CEILING:
            return isPowerOfTwo(x) ? logFloor : logFloor + 1;
    
          case HALF_DOWN:
          case HALF_UP:
          case HALF_EVEN:
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 18.9K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/IntMath.java

       *
       * <p>This differs from {@code Integer.bitCount(x) == 1}, because {@code
       * Integer.bitCount(Integer.MIN_VALUE) == 1}, but {@link Integer#MIN_VALUE} is not a power of two.
       */
      public static boolean isPowerOfTwo(int x) {
        return x > 0 & (x & (x - 1)) == 0;
      }
    
      /**
       * Returns 1 if {@code x < y} as unsigned integers, and 0 otherwise. Assumes that x - y fits into
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 23.5K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/math/LongMath.java

       * Long.bitCount(Long.MIN_VALUE) == 1}, but {@link Long#MIN_VALUE} is not a power of two.
       */
      @SuppressWarnings("ShortCircuitBoolean")
      public static boolean isPowerOfTwo(long x) {
        return x > 0 & (x & (x - 1)) == 0;
      }
    
      /**
       * Returns 1 if {@code x < y} as unsigned longs, and 0 otherwise. Assumes that x - y fits into a
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 44.6K bytes
    - Viewed (0)
Back to top