Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for bitCount (0.2 sec)

  1. android/guava/src/com/google/common/hash/BloomFilterStrategies.java

          this.bitCount = LongAddables.create();
        }
    
        // Used by serialization
        LockFreeBitArray(long[] data) {
          checkArgument(data.length > 0, "data length is zero!");
          this.data = new AtomicLongArray(data);
          this.bitCount = LongAddables.create();
          long bitCount = 0;
          for (long value : data) {
            bitCount += Long.bitCount(value);
          }
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Oct 10 19:45:10 GMT 2022
    - 10.7K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/hash/BloomFilter.java

       *
       * @since 22.0
       */
      public long approximateElementCount() {
        long bitSize = bits.bitSize();
        long bitCount = bits.bitCount();
    
        /**
         * Each insertion is expected to reduce the # of clear bits by a factor of
         * `numHashFunctions/bitSize`. So, after n insertions, expected bitCount is `bitSize * (1 - (1 -
         * numHashFunctions/bitSize)^n)`. Solving that for n, and approximating `ln x` as `x - 1` when x
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 23.1K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/IntMath.java

        checkPositive("x", x);
        return Integer.highestOneBit(x);
      }
    
      /**
       * Returns {@code true} if {@code x} represents a power of two.
       *
       * <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;
      }
    
      /**
    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. guava-tests/test/com/google/common/math/IntMathTest.java

      public void testIsPowerOfTwo() {
        for (int x : ALL_INTEGER_CANDIDATES) {
          // Checks for a single bit set.
          BigInteger bigX = BigInteger.valueOf(x);
          boolean expected = (bigX.signum() > 0) && (bigX.bitCount() == 1);
          assertEquals(expected, IntMath.isPowerOfTwo(x));
        }
      }
    
      public void testLog2ZeroAlwaysThrows() {
        for (RoundingMode mode : ALL_ROUNDING_MODES) {
          try {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/math/IntMathTest.java

      public void testIsPowerOfTwo() {
        for (int x : ALL_INTEGER_CANDIDATES) {
          // Checks for a single bit set.
          BigInteger bigX = BigInteger.valueOf(x);
          boolean expected = (bigX.signum() > 0) && (bigX.bitCount() == 1);
          assertEquals(expected, IntMath.isPowerOfTwo(x));
        }
      }
    
      public void testLog2ZeroAlwaysThrows() {
        for (RoundingMode mode : ALL_ROUNDING_MODES) {
          try {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/math/LongMath.java

        return 1L << ((Long.SIZE - 1) - Long.numberOfLeadingZeros(x));
      }
    
      /**
       * Returns {@code true} if {@code x} represents a power of two.
       *
       * <p>This differs from {@code Long.bitCount(x) == 1}, because {@code
       * 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) {
    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)
  7. android/guava-tests/test/com/google/common/math/LongMathTest.java

      public void testIsPowerOfTwo() {
        for (long x : ALL_LONG_CANDIDATES) {
          // Checks for a single bit set.
          BigInteger bigX = BigInteger.valueOf(x);
          boolean expected = (bigX.signum() > 0) && (bigX.bitCount() == 1);
          assertEquals(expected, LongMath.isPowerOfTwo(x));
        }
      }
    
      public void testLog2ZeroAlwaysThrows() {
        for (RoundingMode mode : ALL_ROUNDING_MODES) {
          try {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/math/LongMathTest.java

      public void testIsPowerOfTwo() {
        for (long x : ALL_LONG_CANDIDATES) {
          // Checks for a single bit set.
          BigInteger bigX = BigInteger.valueOf(x);
          boolean expected = (bigX.signum() > 0) && (bigX.bitCount() == 1);
          assertEquals(expected, LongMath.isPowerOfTwo(x));
        }
      }
    
      public void testLog2ZeroAlwaysThrows() {
        for (RoundingMode mode : ALL_ROUNDING_MODES) {
          try {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  9. guava/src/com/google/common/cache/CacheStats.java

      public long hitCount() {
        return hitCount;
      }
    
      /**
       * Returns the ratio of cache requests which were hits. This is defined as {@code hitCount /
       * requestCount}, or {@code 1.0} when {@code requestCount == 0}. Note that {@code hitRate +
       * missRate =~ 1.0}.
       */
      public double hitRate() {
        long requestCount = requestCount();
        return (requestCount == 0) ? 1.0 : (double) hitCount / requestCount;
      }
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Sun Aug 07 02:38:22 GMT 2022
    - 12.6K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/cache/CacheStats.java

      public long hitCount() {
        return hitCount;
      }
    
      /**
       * Returns the ratio of cache requests which were hits. This is defined as {@code hitCount /
       * requestCount}, or {@code 1.0} when {@code requestCount == 0}. Note that {@code hitRate +
       * missRate =~ 1.0}.
       */
      public double hitRate() {
        long requestCount = requestCount();
        return (requestCount == 0) ? 1.0 : (double) hitCount / requestCount;
      }
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Sun Aug 07 02:38:22 GMT 2022
    - 12.6K bytes
    - Viewed (0)
Back to top