Lines Matching refs:Src
40 template <typename Dst, typename Src>
43 static constexpr Dst Do(Src) { in Do()
53 template <typename Dst, typename Src, typename Enable = void>
56 static constexpr bool Do(Src value) { in Do()
63 template <typename Dst, typename Src>
65 Dst, Src,
67 std::is_integral<Dst>::value && std::is_integral<Src>::value &&
68 std::is_signed<Dst>::value && std::is_signed<Src>::value &&
69 !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
72 static constexpr bool Do(Src value) {
80 template <typename Dst, typename Src>
82 Dst, Src,
84 std::is_integral<Dst>::value && std::is_integral<Src>::value &&
85 !std::is_signed<Dst>::value && std::is_signed<Src>::value &&
86 !IsTypeInRangeForNumericType<Dst, Src>::value>::type> {
89 static constexpr bool Do(Src value) {
92 return as_unsigned(value) <= as_unsigned(CommonMax<Src, Dst>());
98 template <typename Dst, typename Src>
99 constexpr bool IsValueInRangeForNumericType(Src value) {
100 using SrcType = typename internal::UnderlyingType<Src>::type;
113 typename Src>
114 constexpr Dst checked_cast(Src value) {
117 using SrcType = typename internal::UnderlyingType<Src>::type;
147 template <typename Dst, template <typename> class S, typename Src>
148 constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) {
155 : (std::is_integral<Src>::value || !constraint.IsUnderflowFlagSet()
163 template <typename Dst, typename Src, typename Enable = void>
166 static constexpr Dst Do(Src value) {
172 template <typename Dst, typename Src>
174 Dst, Src,
175 typename std::enable_if<std::is_integral<Src>::value &&
177 SaturateFastAsmOp<Dst, Src>::is_supported>::type> {
179 static constexpr Dst Do(Src value) {
180 return SaturateFastAsmOp<Dst, Src>::Do(value);
184 template <typename Dst, typename Src>
186 Dst, Src,
187 typename std::enable_if<std::is_integral<Src>::value &&
189 !SaturateFastAsmOp<Dst, Src>::is_supported>::type> {
191 static constexpr Dst Do(Src value) {
195 const Dst saturated = CommonMaxOrMin<Dst, Src>(
196 IsMaxInRangeForNumericType<Dst, Src>() ||
197 (!IsMinInRangeForNumericType<Dst, Src>() && IsValueNegative(value)));
210 typename Src>
211 constexpr Dst saturated_cast(Src value) {
212 using SrcType = typename UnderlyingType<Src>::type;
227 template <typename Dst, typename Src>
228 constexpr Dst strict_cast(Src value) {
229 using SrcType = typename UnderlyingType<Src>::type;
230 static_assert(UnderlyingType<Src>::is_numeric, "Argument must be numeric.");
248 template <typename Dst, typename Src, class Enable = void>
253 template <typename Dst, typename Src>
255 Dst, Src,
257 ArithmeticOrUnderlyingEnum<Src>::value>::type> {
259 StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
281 template <typename Src>
282 constexpr StrictNumeric(const StrictNumeric<Src>& rhs)
287 template <typename Src>
288 constexpr StrictNumeric(Src value) // NOLINT(runtime/explicit)
365 template <typename Dst = int, typename Src,
367 std::is_floating_point<Src>::value>>
368 Dst ClampFloor(Src value) {
371 template <typename Dst = int, typename Src,
373 std::is_floating_point<Src>::value>>
374 Dst ClampCeil(Src value) {
377 template <typename Dst = int, typename Src,
379 std::is_floating_point<Src>::value>>
380 Dst ClampRound(Src value) {
381 const Src rounded =