Lines Matching defs:value
38 static constexpr bool Do(Src value) {
50 std::is_integral<Dst>::value && std::is_integral<Src>::value &&
51 std::is_signed<Dst>::value && std::is_signed<Src>::value &&
52 !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
55 static constexpr bool Do(Src value) {
57 // type, and then see if it matches the original value.
58 return value == static_cast<Dst>(value);
68 std::is_integral<Dst>::value && std::is_integral<Src>::value &&
69 !std::is_signed<Dst>::value && std::is_signed<Src>::value &&
70 !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
73 static constexpr bool Do(Src value) {
76 return as_unsigned(value) <= as_unsigned(CommonMax<Src, Dst>());
80 // Convenience function that returns true if the supplied value is in range
83 constexpr bool IsValueInRangeForNumericType(Src value) {
87 static_cast<SrcType>(value))
89 static_cast<SrcType>(value))
99 constexpr Dst checked_cast(Src value) {
103 return BASE_NUMERICS_LIKELY((IsValueInRangeForNumericType<Dst>(value)))
104 ? static_cast<Dst>(static_cast<SrcType>(value))
133 constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) {
137 ? (!constraint.IsUnderflowFlagSet() ? static_cast<Dst>(value)
140 : (std::is_integral<Src>::value || !constraint.IsUnderflowFlagSet()
151 static constexpr Dst Do(Src value) {
161 typename std::enable_if<std::is_integral<Src>::value &&
162 std::is_integral<Dst>::value>::type> {
164 static Dst Do(Src value) {
166 return SaturateFastAsmOp<Dst, Src>::Do(value);
173 (!IsMinInRangeForNumericType<Dst, Src>() && IsValueNegative(value)));
174 return BASE_NUMERICS_LIKELY(IsValueInRangeForNumericType<Dst>(value))
175 ? static_cast<Dst>(value)
187 constexpr Dst saturated_cast(Src value) {
189 return !IsCompileTimeConstant(value) &&
192 SaturationDefaultLimits<Dst>>::value
193 ? SaturateFastOp<Dst, SrcType>::Do(static_cast<SrcType>(value))
195 static_cast<SrcType>(value),
197 static_cast<SrcType>(value)));
202 // to contain any value in the source type. It performs no runtime checking.
204 constexpr Dst strict_cast(Src value) {
207 static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric.");
215 static_assert(StaticDstRangeRelationToSrcRange<Dst, SrcType>::value ==
220 return static_cast<Dst>(static_cast<SrcType>(value));
226 static const bool value = false;
233 typename std::enable_if<ArithmeticOrUnderlyingEnum<Dst>::value &&
234 ArithmeticOrUnderlyingEnum<Src>::value>::type> {
235 static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
248 // CheckedNumeric for runtime range checks of the actual value being assigned.
264 constexpr StrictNumeric(Src value) // NOLINT(runtime/explicit)
265 : value_(strict_cast<T>(value)) {}
273 // the member value functions (e.g. val.template ValueOrDie<Dst>()), use one
274 // of the value helper functions (e.g. ValueOrDieForType<Dst>(val)).
281 IsNumericRangeContained<Dst, T>::value>::type* = nullptr>
293 const T value) {
294 return value;
299 std::ostream& operator<<(std::ostream& os, const StrictNumeric<T>& value) {
300 os << static_cast<T>(value);
307 internal::Is##CLASS##Op<L, R>::value>::type* = nullptr> \