Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 17 of 17 for saturatedAdd (0.05 sec)

  1. guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java

        long waitMicros =
            storedPermitsToWaitTime(this.storedPermits, storedPermitsToSpend)
                + (long) (freshPermits * stableIntervalMicros);
    
        this.nextFreeTicketMicros = LongMath.saturatedAdd(nextFreeTicketMicros, waitMicros);
        this.storedPermits -= storedPermitsToSpend;
        return returnValue;
      }
    
      /**
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Wed May 14 19:40:47 UTC 2025
    - 19.3K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/collect/Sets.java

    import static com.google.common.base.Preconditions.checkNotNull;
    import static com.google.common.collect.CollectPreconditions.checkNonnegative;
    import static com.google.common.math.IntMath.saturatedAdd;
    import static java.lang.Math.max;
    import static java.lang.Math.min;
    import static java.util.Arrays.asList;
    
    import com.google.common.annotations.GwtCompatible;
    import com.google.common.annotations.GwtIncompatible;
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Sep 22 18:35:44 UTC 2025
    - 81.6K bytes
    - Viewed (0)
  3. guava-tests/test/com/google/common/math/IntMathTest.java

        for (int a : ALL_INTEGER_CANDIDATES) {
          for (int b : ALL_INTEGER_CANDIDATES) {
            assertOperationEquals(
                a, b, "s+", saturatedCast(valueOf(a).add(valueOf(b))), IntMath.saturatedAdd(a, b));
          }
        }
      }
    
      @AndroidIncompatible // slow
      @GwtIncompatible // TODO
      public void testSaturatedSubtract() {
        for (int a : ALL_INTEGER_CANDIDATES) {
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 24.1K bytes
    - Viewed (0)
  4. guava/src/com/google/common/collect/Multisets.java

          }
    
          @Override
          public boolean isEmpty() {
            return multiset1.isEmpty() && multiset2.isEmpty();
          }
    
          @Override
          public int size() {
            return IntMath.saturatedAdd(multiset1.size(), multiset2.size());
          }
    
          @Override
          public int count(@Nullable Object element) {
            return multiset1.count(element) + multiset2.count(element);
          }
    
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Sep 22 18:35:44 UTC 2025
    - 41.2K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/collect/Multisets.java

          }
    
          @Override
          public boolean isEmpty() {
            return multiset1.isEmpty() && multiset2.isEmpty();
          }
    
          @Override
          public int size() {
            return IntMath.saturatedAdd(multiset1.size(), multiset2.size());
          }
    
          @Override
          public int count(@Nullable Object element) {
            return multiset1.count(element) + multiset2.count(element);
          }
    
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Sep 22 18:35:44 UTC 2025
    - 41.3K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java

          if (maybeExpand && uniques * 4 > length * 3) {
            // lots of nonduplicated elements, expand the array by 50%
            sortedElements =
                Arrays.copyOf(sortedElements, IntMath.saturatedAdd(length, length / 2 + 1));
          }
          int[] sortedCounts = new int[sortedElements.length];
          for (int i = 0; i < length; i++) {
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Tue May 13 17:27:14 UTC 2025
    - 35.2K bytes
    - Viewed (0)
  7. guava/src/com/google/common/math/LongMath.java

       *
       * @since 20.0
       */
      // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, ||
      @SuppressWarnings("ShortCircuitBoolean")
      public static long saturatedAdd(long a, long b) {
        long naiveSum = a + b;
        if ((a ^ b) < 0 | (a ^ naiveSum) >= 0) {
          // If a and b have different signs or a has the same sign as the result then there was no
          // overflow, return.
    Registered: Fri Dec 26 12:43:10 UTC 2025
    - Last Modified: Mon Nov 03 21:01:09 UTC 2025
    - 46.8K bytes
    - Viewed (0)
Back to top