• Home
  • Raw
  • Download

Lines Matching refs:Dst

22 template <typename Dst, typename Src>
25 static constexpr Dst Do(Src) { in Do()
27 return CheckOnFailure::template HandleFailure<Dst>(); in Do()
35 template <typename Dst, typename Src, typename Enable = void>
45 template <typename Dst, typename Src>
47 Dst,
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> {
58 return value == static_cast<Dst>(value);
63 template <typename Dst, typename Src>
65 Dst,
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> {
76 return as_unsigned(value) <= as_unsigned(CommonMax<Src, Dst>());
82 template <typename Dst, typename Src>
85 return internal::IsValueInRangeFastOp<Dst, SrcType>::is_supported
86 ? internal::IsValueInRangeFastOp<Dst, SrcType>::Do(
88 : internal::DstRangeRelationToSrcRange<Dst>(
96 template <typename Dst,
99 constexpr Dst checked_cast(Src value) {
103 return BASE_NUMERICS_LIKELY((IsValueInRangeForNumericType<Dst>(value)))
104 ? static_cast<Dst>(static_cast<SrcType>(value))
105 : CheckHandler::template HandleFailure<Dst>();
132 template <typename Dst, template <typename> class S, typename Src>
133 constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) {
137 ? (!constraint.IsUnderflowFlagSet() ? static_cast<Dst>(value)
138 : S<Dst>::Underflow())
141 ? S<Dst>::Overflow()
142 : S<Dst>::NaN());
148 template <typename Dst, typename Src, typename Enable = void>
151 static constexpr Dst Do(Src value) {
153 return CheckOnFailure::template HandleFailure<Dst>();
157 template <typename Dst, typename Src>
159 Dst,
162 std::is_integral<Dst>::value>::type> {
164 static Dst Do(Src value) {
165 if (SaturateFastAsmOp<Dst, Src>::is_supported)
166 return SaturateFastAsmOp<Dst, Src>::Do(value);
171 Dst saturated = CommonMaxOrMin<Dst, Src>(
172 IsMaxInRangeForNumericType<Dst, Src>() ||
173 (!IsMinInRangeForNumericType<Dst, Src>() && IsValueNegative(value)));
174 return BASE_NUMERICS_LIKELY(IsValueInRangeForNumericType<Dst>(value))
175 ? static_cast<Dst>(value)
184 template <typename Dst,
187 constexpr Dst saturated_cast(Src value) {
190 SaturateFastOp<Dst, SrcType>::is_supported &&
191 std::is_same<SaturationHandler<Dst>,
192 SaturationDefaultLimits<Dst>>::value
193 ? SaturateFastOp<Dst, SrcType>::Do(static_cast<SrcType>(value))
194 : saturated_cast_impl<Dst, SaturationHandler, SrcType>(
196 DstRangeRelationToSrcRange<Dst, SaturationHandler, SrcType>(
203 template <typename Dst, typename Src>
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));
224 template <typename Dst, typename Src, class Enable = void>
229 template <typename Dst, typename Src>
231 Dst,
233 typename std::enable_if<ArithmeticOrUnderlyingEnum<Dst>::value &&
235 static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
279 template <typename Dst,
281 IsNumericRangeContained<Dst, T>::value>::type* = nullptr>
282 constexpr operator Dst() const {
283 return static_cast<typename ArithmeticOrUnderlyingEnum<Dst>::type>(value_);