- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for checkedAdd (0.17 sec)
-
android/guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java
public boolean noAddOverflow(int a, int b) { try { int unused = IntMath.checkedAdd(a, b); return true; } catch (ArithmeticException e) { return false; } } @Override public boolean noAddOverflow(long a, long b) { try { long unused = LongMath.checkedAdd(a, b); return true; } catch (ArithmeticException e) {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Mon Dec 04 17:37:03 UTC 2017 - 6.9K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/LongMathTest.java
boolean expectedSuccess = fitsInLong(expectedResult); try { assertEquals(a + b, LongMath.checkedAdd(a, b)); assertTrue(expectedSuccess); } catch (ArithmeticException e) { if (expectedSuccess) { failFormat( "expected checkedAdd(%s, %s) = %s; got ArithmeticException", a, b, expectedResult); } } } } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 15:00:32 UTC 2024 - 30.6K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/IntMathTest.java
for (int b : ALL_INTEGER_CANDIDATES) { BigInteger expectedResult = valueOf(a).add(valueOf(b)); boolean expectedSuccess = fitsInInt(expectedResult); try { assertEquals(a + b, IntMath.checkedAdd(a, b)); assertTrue(expectedSuccess); } catch (ArithmeticException e) { assertFalse(expectedSuccess); } } } } @AndroidIncompatible // slow
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 30 16:15:19 UTC 2024 - 21.1K bytes - Viewed (0) -
guava/src/com/google/common/math/LongMath.java
*/ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || @SuppressWarnings("ShortCircuitBoolean") public static long checkedAdd(long a, long b) { long result = a + b; checkNoOverflow((a ^ b) < 0 | (a ^ result) >= 0, "checkedAdd", a, b); return result; } /** * Returns the difference of {@code a} and {@code b}, provided it does not overflow. *
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/math/IntMathTest.java
for (int b : ALL_INTEGER_CANDIDATES) { BigInteger expectedResult = valueOf(a).add(valueOf(b)); boolean expectedSuccess = fitsInInt(expectedResult); try { assertEquals(a + b, IntMath.checkedAdd(a, b)); assertTrue(expectedSuccess); } catch (ArithmeticException e) { assertFalse(expectedSuccess); } } } } @AndroidIncompatible // slow
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
android/guava/src/com/google/common/math/LongMath.java
*/ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || @SuppressWarnings("ShortCircuitBoolean") public static long checkedAdd(long a, long b) { long result = a + b; checkNoOverflow((a ^ b) < 0 | (a ^ result) >= 0, "checkedAdd", a, b); return result; } /** * Returns the difference of {@code a} and {@code b}, provided it does not overflow. *
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0)