Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for checkedMultiply (0.18 sec)

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

         */
        if (leadingZeros > Long.SIZE + 1) {
          return a * b;
        }
        checkNoOverflow(leadingZeros >= Long.SIZE, "checkedMultiply", a, b);
        checkNoOverflow(a >= 0 | b != Long.MIN_VALUE, "checkedMultiply", a, b);
        long result = a * b;
        checkNoOverflow(a == 0 || result / a == b, "checkedMultiply", a, b);
        return result;
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/math/LongMath.java

         */
        if (leadingZeros > Long.SIZE + 1) {
          return a * b;
        }
        checkNoOverflow(leadingZeros >= Long.SIZE, "checkedMultiply", a, b);
        checkNoOverflow(a >= 0 | b != Long.MIN_VALUE, "checkedMultiply", a, b);
        long result = a * b;
        checkNoOverflow(a == 0 || result / a == b, "checkedMultiply", a, b);
        return result;
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/IntMath.java

       *
       * @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic
       */
      public static int checkedMultiply(int a, int b) {
        long result = (long) a * b;
        checkNoOverflow(result == (int) result, "checkedMultiply", a, b);
        return (int) result;
      }
    
      /**
       * Returns the {@code b} to the {@code k}th power, provided it does not overflow.
       *
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  4. guava/src/com/google/common/math/IntMath.java

       *
       * @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic
       */
      public static int checkedMultiply(int a, int b) {
        long result = (long) a * b;
        checkNoOverflow(result == (int) result, "checkedMultiply", a, b);
        return (int) result;
      }
    
      /**
       * Returns the {@code b} to the {@code k}th power, provided it does not overflow.
       *
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/math/LongMathTest.java

            boolean expectedSuccess = fitsInLong(expectedResult);
            try {
              assertEquals(a * b, LongMath.checkedMultiply(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              if (expectedSuccess) {
                failFormat(
                    "expected checkedMultiply(%s, %s) = %s; got ArithmeticException",
                    a, b, expectedResult);
              }
            }
          }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/math/LongMathTest.java

            boolean expectedSuccess = fitsInLong(expectedResult);
            try {
              assertEquals(a * b, LongMath.checkedMultiply(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              if (expectedSuccess) {
                failFormat(
                    "expected checkedMultiply(%s, %s) = %s; got ArithmeticException",
                    a, b, expectedResult);
              }
            }
          }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  7. guava/src/com/google/common/collect/TopKSelector.java

        this.k = k;
        checkArgument(k >= 0, "k (%s) must be >= 0", k);
        checkArgument(k <= Integer.MAX_VALUE / 2, "k (%s) must be <= Integer.MAX_VALUE / 2", k);
        this.buffer = (T[]) new Object[IntMath.checkedMultiply(k, 2)];
        this.bufferSize = 0;
        this.threshold = null;
      }
    
      /**
       * Adds {@code elem} as a candidate for the top {@code k} elements. This operation takes amortized
       * O(1) time.
       */
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/collect/TopKSelector.java

        this.k = k;
        checkArgument(k >= 0, "k (%s) must be >= 0", k);
        checkArgument(k <= Integer.MAX_VALUE / 2, "k (%s) must be <= Integer.MAX_VALUE / 2", k);
        this.buffer = (T[]) new Object[IntMath.checkedMultiply(k, 2)];
        this.bufferSize = 0;
        this.threshold = null;
      }
    
      /**
       * Adds {@code elem} as a candidate for the top {@code k} elements. This operation takes amortized
       * O(1) time.
       */
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  9. android/guava-tests/test/com/google/common/math/IntMathTest.java

            BigInteger expectedResult = valueOf(a).multiply(valueOf(b));
            boolean expectedSuccess = fitsInInt(expectedResult);
            try {
              assertEquals(a * b, IntMath.checkedMultiply(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              assertFalse(expectedSuccess);
            }
          }
        }
      }
    
      public void testCheckedPow() {
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 24.5K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/hash/BloomFilter.java

          dataLength = din.readInt();
    
          Strategy strategy = BloomFilterStrategies.values()[strategyOrdinal];
    
          LockFreeBitArray dataArray = new LockFreeBitArray(LongMath.checkedMultiply(dataLength, 64L));
          for (int i = 0; i < dataLength; i++) {
            dataArray.putData(i, din.readLong());
          }
    
          return new BloomFilter<>(dataArray, numHashFunctions, funnel, strategy);
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 23.1K bytes
    - Viewed (0)
Back to top