Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 46 for bitCount (0.29 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. okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der/DerWriter.kt

          writeVariableLengthLong(vN)
        }
      }
    
      /** Used for tags and subidentifiers. */
      private fun writeVariableLengthLong(v: Long) {
        val sink = sink()
        val bitCount = 64 - java.lang.Long.numberOfLeadingZeros(v)
        val byteCount = (bitCount + 6) / 7
        for (shift in (byteCount - 1) * 7 downTo 0 step 7) {
          val lastBit = if (shift == 0) 0 else 0b1000_0000
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.7K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/internal/http2/Huffman.kt

          sink.writeByte(accumulator.toInt())
        }
      }
    
      fun encodedLength(bytes: ByteString): Int {
        var bitCount = 0L
    
        for (i in 0 until bytes.size) {
          val byteIn = bytes[i] and 0xff
          bitCount += CODE_BIT_COUNTS[byteIn].toLong()
        }
    
        return ((bitCount + 7) shr 3).toInt() // Round up to an even byte.
      }
    
      fun decode(
        source: BufferedSource,
        byteCount: Long,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  4. src/main/java/jcifs/util/Crypto.java

            key8[ 6 ] = (byte) ( ( key[ 5 ] << 2 ) | ( ( key[ 6 ] & 0xFF ) >>> 6 ) );
            key8[ 7 ] = (byte) ( key[ 6 ] << 1 );
            for ( int i = 0; i < key8.length; i++ ) {
                key8[ i ] ^= Integer.bitCount(key8[ i ] ^ 1) & 1;
            }
            return key8;
        }
    
        /**
         * Default provider is BouncyCastleProvider.
         * For registering custom provider
    Java
    - Registered: Sun Apr 21 00:10:10 GMT 2024
    - Last Modified: Tue Aug 17 17:34:29 GMT 2021
    - 5.2K bytes
    - Viewed (0)
  5. 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)
  6. okhttp/src/main/kotlin/okhttp3/internal/http2/Settings.kt

      }
    
      /** Returns the value for the setting `id`, or 0 if unset. */
      operator fun get(id: Int): Int = values[id]
    
      /** Returns the number of settings that have values assigned. */
      fun size(): Int = Integer.bitCount(set)
    
      // TODO: honor this setting.
      fun getEnablePush(defaultValue: Boolean): Boolean {
        val bit = 1 shl ENABLE_PUSH
        return if (bit and set != 0) values[ENABLE_PUSH] == 1 else defaultValue
      }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top