Lines Matching refs:value

28   static const int value = std::is_floating_point<NumericType>::value
37 static const int value = std::numeric_limits<NumericType>::digits +
38 std::is_signed<NumericType>::value;
45 static const size_t value = IntegerBitsPlusSign<Integer>::value - 1;
48 // Determines if a numeric value is negative without throwing compiler
49 // warnings on: unsigned(value) < 0.
51 typename std::enable_if<std::is_signed<T>::value>::type* = nullptr>
52 constexpr bool IsValueNegative(T value) {
53 static_assert(std::is_arithmetic<T>::value, "Argument must be numeric.");
54 return value < 0;
58 typename std::enable_if<!std::is_signed<T>::value>::type* = nullptr>
60 static_assert(std::is_arithmetic<T>::value, "Argument must be numeric.");
64 // This performs a fast negation, returning a signed value. It works on unsigned
65 // arguments, but probably doesn't do what you want for any unsigned value
71 static_assert(std::is_integral<T>::value, "Type must be integral");
78 // This performs a safe, absolute value via unsigned overflow.
80 constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) {
81 static_assert(std::is_integral<T>::value, "Type must be integral");
83 return IsValueNegative(value) ? 0 - static_cast<UnsignedT>(value)
84 : static_cast<UnsignedT>(value);
149 IntegerRepresentation DstSign = std::is_signed<Dst>::value
152 IntegerRepresentation SrcSign = std::is_signed<Src>::value
161 static const NumericRangeRepresentation value =
162 MaxExponent<Dst>::value >= MaxExponent<Src>::value
174 static const NumericRangeRepresentation value =
175 MaxExponent<Dst>::value > MaxExponent<Src>::value
186 static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED;
223 // floats, which round to nearest and thus result in a value of larger
224 // magnitude than the integral value.
227 // 2. If the floating point value is equal to the promoted integral maximum
228 // value, a range check will erroneously pass.
231 // 3. When the floating point value is then converted to an integral, the
232 // resulting value is out of range for the target integral type and
235 // To fix this bug we manually truncate the maximum value when the destination
245 (MaxExponent<Src>::value > MaxExponent<Dst>::value &&
251 typename std::enable_if<std::is_integral<T>::value>::type* = nullptr>
255 static constexpr T Adjust(T value) {
256 static_assert(std::is_same<T, Dst>::value, "");
259 ConditionalNegate(SafeUnsignedAbs(value) & ~((T(1) << kShift) - T(1)),
260 IsValueNegative(value)));
264 typename std::enable_if<std::is_floating_point<T>::value>::type* =
266 static constexpr T Adjust(T value) {
267 static_assert(std::is_same<T, Dst>::value, "");
269 return value;
280 IntegerRepresentation DstSign = std::is_signed<Dst>::value
283 IntegerRepresentation SrcSign = std::is_signed<Src>::value
287 StaticDstRangeRelationToSrcRange<Dst, Src>::value>
307 static constexpr RangeCheck Check(Src value) {
312 static_cast<Dst>(value) >= DstLimits::lowest(),
314 static_cast<Dst>(value) <= DstLimits::max());
327 static constexpr RangeCheck Check(Src value) {
329 return RangeCheck(value >= DstLimits::lowest(), value <= DstLimits::max());
342 static constexpr RangeCheck Check(Src value) {
345 DstLimits::lowest() == Dst(0) || value >= DstLimits::lowest(),
346 value <= DstLimits::max());
358 static constexpr RangeCheck Check(Src value) {
362 static_cast<Promotion>(value) >=
364 static_cast<Promotion>(value) <=
370 // and any negative value exceeds the lower boundary for standard limits.
378 static constexpr RangeCheck Check(Src value) {
383 value >= Src(0) && (DstLimits::lowest() == 0 ||
384 static_cast<Dst>(value) >= DstLimits::lowest()),
387 static_cast<Promotion>(value) <=
395 static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
402 constexpr RangeCheck DstRangeRelationToSrcRange(Src value) {
403 static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric.");
404 static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric.");
406 return DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds>::Check(value);
415 struct IntegerForDigitsAndSign<IntegerBitsPlusSign<I>::value, \
416 std::is_signed<I>::value> { \
433 static_assert(IntegerBitsPlusSign<intmax_t>::value == 64,
436 template <typename Integer, bool IsSigned = std::is_signed<Integer>::value>
439 typename IntegerForDigitsAndSign<IntegerBitsPlusSign<Integer>::value * 2,
448 // Determines the type that can represent the largest positive value.
452 (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value)
467 // Determines the type that can represent the lowest arithmetic value.
471 std::is_signed<Lhs>::value
472 ? (std::is_signed<Rhs>::value
473 ? (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value
477 : (std::is_signed<Rhs>::value
479 : (MaxExponent<Lhs>::value < MaxExponent<Rhs>::value
500 typename MaxExponentPromotion<Lhs, Rhs>::type>::value &&
502 value == IntegerBitsPlusSign<intmax_t>::value,
505 Lhs>::value == NUMERIC_RANGE_CONTAINED &&
508 Rhs>::value == NUMERIC_RANGE_CONTAINED>
523 std::is_signed<Lhs>::value ||
524 std::is_signed<Rhs>::value>::type;
541 static const bool value =
542 !std::is_floating_point<T>::value &&
543 !std::is_floating_point<Lhs>::value &&
544 !std::is_floating_point<Rhs>::value &&
545 std::is_signed<T>::value >= std::is_signed<Lhs>::value &&
546 IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Lhs>::value) &&
547 std::is_signed<T>::value >= std::is_signed<Rhs>::value &&
548 IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Rhs>::value);
556 typename std::conditional<std::is_signed<Lhs>::value ||
557 std::is_signed<Rhs>::value,
560 typename MaxExponentPromotion<Lhs, Rhs>::type>::value>
567 std::is_signed<Lhs>::value ||
568 std::is_signed<Rhs>::value>::type;
569 static_assert(IsIntegerArithmeticSafe<type, Lhs, Rhs>::value, "");
580 template <typename T, bool is_enum = std::is_enum<T>::value>
586 static const bool value = std::is_arithmetic<type>::value;
592 static const bool value = std::is_arithmetic<type>::value;
609 static const bool is_numeric = std::is_arithmetic<type>::value;
644 static const bool value =
651 static const bool value =
659 static const bool value =
666 // as_signed<> returns the supplied integral value (or integral castable
672 as_signed(const Src value) {
673 static_assert(std::is_integral<decltype(as_signed(value))>::value,
675 return static_cast<decltype(as_signed(value))>(value);
678 // as_unsigned<> returns the supplied integral value (or integral castable
684 as_unsigned(const Src value) {
685 static_assert(std::is_integral<decltype(as_unsigned(value))>::value,
687 return static_cast<decltype(as_unsigned(value))>(value);
702 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
722 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
742 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
762 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
772 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
784 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
798 static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
838 // If the argument is false, the returned value is the maximum. If true the
839 // returned value is the minimum.