Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for saturatedCast (0.14 sec)

  1. android/guava-tests/test/com/google/common/primitives/UnsignedIntsTest.java

          assertThat(UnsignedInts.toLong(UnsignedInts.saturatedCast(value))).isEqualTo(value);
        }
        assertThat(UnsignedInts.saturatedCast(1L << 32)).isEqualTo(GREATEST);
        assertThat(UnsignedInts.saturatedCast(-1L)).isEqualTo(LEAST);
        assertThat(UnsignedInts.saturatedCast(Long.MAX_VALUE)).isEqualTo(GREATEST);
        assertThat(UnsignedInts.saturatedCast(Long.MIN_VALUE)).isEqualTo(LEAST);
      }
    
      public void testToLong() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 02:56:12 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/primitives/UnsignedBytesTest.java

        for (byte value : VALUES) {
          assertThat(UnsignedBytes.saturatedCast(UnsignedBytes.toInt(value))).isEqualTo(value);
        }
        assertThat(UnsignedBytes.saturatedCast(256L)).isEqualTo(GREATEST);
        assertThat(UnsignedBytes.saturatedCast(-1L)).isEqualTo(LEAST);
        assertThat(UnsignedBytes.saturatedCast(Long.MAX_VALUE)).isEqualTo(GREATEST);
        assertThat(UnsignedBytes.saturatedCast(Long.MIN_VALUE)).isEqualTo(LEAST);
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 19:07:49 UTC 2024
    - 13.4K bytes
    - Viewed (0)
  3. guava-tests/test/com/google/common/math/IntMathTest.java

                b,
                "s*",
                saturatedCast(valueOf(a).multiply(valueOf(b))),
                IntMath.saturatedMultiply(a, b));
          }
        }
      }
    
      @GwtIncompatible // TODO
      public void testSaturatedPow() {
        for (int a : ALL_INTEGER_CANDIDATES) {
          for (int b : EXPONENTS) {
            assertOperationEquals(
                a, b, "s^", saturatedCast(valueOf(a).pow(b)), IntMath.saturatedPow(a, b));
          }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/IntMathTest.java

                b,
                "s*",
                saturatedCast(valueOf(a).multiply(valueOf(b))),
                IntMath.saturatedMultiply(a, b));
          }
        }
      }
    
      @GwtIncompatible // TODO
      public void testSaturatedPow() {
        for (int a : ALL_INTEGER_CANDIDATES) {
          for (int b : EXPONENTS) {
            assertOperationEquals(
                a, b, "s^", saturatedCast(valueOf(a).pow(b)), IntMath.saturatedPow(a, b));
          }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/primitives/CharsTest.java

        for (char value : VALUES) {
          assertThat(Chars.saturatedCast((long) value)).isEqualTo(value);
        }
        assertThat(Chars.saturatedCast(GREATEST + 1L)).isEqualTo(GREATEST);
        assertThat(Chars.saturatedCast(LEAST - 1L)).isEqualTo(LEAST);
        assertThat(Chars.saturatedCast(Long.MAX_VALUE)).isEqualTo(GREATEST);
        assertThat(Chars.saturatedCast(Long.MIN_VALUE)).isEqualTo(LEAST);
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 02:56:12 UTC 2024
    - 25.6K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/math/LongMathTest.java

                b,
                "s*",
                saturatedCast(valueOf(a).multiply(valueOf(b))),
                LongMath.saturatedMultiply(a, b));
          }
        }
      }
    
      @GwtIncompatible // TODO
      public void testSaturatedPow() {
        for (long a : ALL_LONG_CANDIDATES) {
          for (int b : EXPONENTS) {
            assertOperationEquals(
                a, b, "s^", saturatedCast(valueOf(a).pow(b)), LongMath.saturatedPow(a, b));
          }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/primitives/IntsTest.java

        for (int value : VALUES) {
          assertThat(Ints.saturatedCast((long) value)).isEqualTo(value);
        }
        assertThat(Ints.saturatedCast(GREATEST + 1L)).isEqualTo(GREATEST);
        assertThat(Ints.saturatedCast(LEAST - 1L)).isEqualTo(LEAST);
        assertThat(Ints.saturatedCast(Long.MAX_VALUE)).isEqualTo(GREATEST);
        assertThat(Ints.saturatedCast(Long.MIN_VALUE)).isEqualTo(LEAST);
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 02:56:12 UTC 2024
    - 29.1K bytes
    - Viewed (0)
  8. guava/src/com/google/common/collect/ImmutableRangeSet.java

              total += ContiguousSet.create(range, domain).size();
              if (total >= Integer.MAX_VALUE) {
                break;
              }
            }
            result = size = Ints.saturatedCast(total);
          }
          return result.intValue();
        }
    
        @Override
        public UnmodifiableIterator<C> iterator() {
          return new AbstractIterator<C>() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 27K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/primitives/SignedBytes.java

       * @return the same value cast to {@code byte} if it is in the range of the {@code byte} type,
       *     {@link Byte#MAX_VALUE} if it is too large, or {@link Byte#MIN_VALUE} if it is too small
       */
      public static byte saturatedCast(long value) {
        if (value > Byte.MAX_VALUE) {
          return Byte.MAX_VALUE;
        }
        if (value < Byte.MIN_VALUE) {
          return Byte.MIN_VALUE;
        }
        return (byte) value;
      }
    
      /**
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 13:00:28 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  10. guava/src/com/google/common/collect/AbstractMapBasedMultiset.java

        size = 0L;
      }
    
      @Override
      int distinctElements() {
        return backingMap.size();
      }
    
      // Optimizations - Query Operations
    
      @Override
      public int size() {
        return Ints.saturatedCast(size);
      }
    
      @Override
      public Iterator<E> iterator() {
        return new MapBasedMultisetIterator();
      }
    
      /*
       * Not subclassing AbstractMultiset$MultisetIterator because next() needs to
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 10.4K bytes
    - Viewed (0)
Back to top