8#ifndef V8_BASE_NUMERICS_CLAMPED_MATH_H_
9#define V8_BASE_NUMERICS_CLAMPED_MATH_H_
21 requires std::is_arithmetic_v<T>
29 template <
typename Src>
35 template <
typename Src>
42 template <
typename Src>
45 :
value_(saturated_cast<T>(static_cast<Src>(value))) {}
49 template <
typename Dst>
55 template <
typename Src>
57 template <
typename Src>
59 template <
typename Src>
61 template <
typename Src>
63 template <
typename Src>
65 template <
typename Src>
67 template <
typename Src>
69 template <
typename Src>
71 template <
typename Src>
73 template <
typename Src>
100 template <
typename U>
141 template <
template <
typename,
typename>
class M,
typename L,
typename R>
149 template <
template <
typename,
typename>
class M,
typename R>
157 template <
typename Dst>
158 requires std::is_arithmetic_v<ArithmeticOrUnderlyingEnum<Dst>>
159 constexpr operator Dst()
const {
160 return saturated_cast<ArithmeticOrUnderlyingEnum<Dst>>(
value_);
169 template <
typename U>
170 requires std::is_arithmetic_v<U>
177 template <
typename Src>
194template <
template <
typename,
typename>
class M,
typename L,
typename R>
203template <
template <
typename,
typename>
class M,
typename L,
typename R,
230using internal::ClampAdd;
231using internal::ClampAnd;
232using internal::ClampDiv;
234using internal::ClampLsh;
235using internal::ClampMax;
236using internal::ClampMin;
237using internal::ClampMod;
238using internal::ClampMul;
239using internal::ClampOr;
240using internal::ClampRsh;
241using internal::ClampSub;
242using internal::ClampXor;
243using internal::MakeClampedNum;
constexpr T RawValue() const
constexpr ClampedNumeric & operator<<=(const Src rhs)
constexpr ClampedNumeric & operator|=(const Src rhs)
constexpr ClampedNumeric & operator/=(const Src rhs)
constexpr ClampedNumeric(StrictNumeric< Src > value)
constexpr ClampedNumeric< UnderlyingType< Dst > > Cast() const
constexpr ClampedNumeric< typename MathWrapper< ClampedMaxOp, T, U >::type > Max(U rhs) const
static constexpr ClampedNumeric MathOp(L lhs, R rhs)
constexpr ClampedNumeric operator~() const
constexpr ClampedNumeric & operator>>=(const Src rhs)
constexpr ClampedNumeric & operator%=(const Src rhs)
constexpr ClampedNumeric & operator-=(const Src rhs)
constexpr ClampedNumeric()=default
constexpr ClampedNumeric Abs() const
constexpr ClampedNumeric & operator&=(const Src rhs)
constexpr ClampedNumeric(Src value)
constexpr ClampedNumeric operator--(int)
constexpr ClampedNumeric< typename UnsignedOrFloatForSize< T >::type > UnsignedAbs() const
constexpr ClampedNumeric & operator++()
constexpr ClampedNumeric< typename MathWrapper< ClampedMinOp, T, U >::type > Min(U rhs) const
constexpr ClampedNumeric operator++(int)
constexpr ClampedNumeric & operator^=(const Src rhs)
constexpr ClampedNumeric operator-() const
constexpr ClampedNumeric & operator+=(const Src rhs)
constexpr ClampedNumeric & MathOp(R rhs)
constexpr ClampedNumeric & operator--()
constexpr ClampedNumeric(const ClampedNumeric< Src > &rhs)
constexpr ClampedNumeric & operator*=(const Src rhs)
friend class ClampedNumeric
constexpr auto SafeUnsignedAbs(T value)
constexpr std::make_unsigned< T >::type InvertWrapper(T value)
UnderlyingTypeImpl< T >::type UnderlyingType
constexpr ClampedNumeric< typename MathWrapper< M, L, R >::type > ClampMathOp(L lhs, R rhs)
constexpr ClampedNumeric< UnderlyingType< T > > MakeClampedNum(T value)
ClampedNumeric(T) -> ClampedNumeric< T >
constexpr T SaturatedAbsWrapper(T value)
constexpr T SaturatedNegWrapper(T value)
V8_BASE_EXPORT int const char va_list args
#define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP)
#define BASE_NUMERIC_ARITHMETIC_OPERATORS(CLASS, CL_ABBR, OP_NAME, OP, CMP_OP)
#define BASE_NUMERIC_ARITHMETIC_VARIADIC(CLASS, CL_ABBR, OP_NAME)
static constexpr UnderlyingType< Src > value(Src value)
typename math::result_type type
std::unique_ptr< ValueMirror > value