16template <
typename T,
typename W>
19 constexpr auto min{std::numeric_limits<T>::min()};
20 constexpr auto max{std::numeric_limits<T>::max()};
22 static_assert(min >= std::numeric_limits<W>::min() / 2);
23 static_assert(max <= std::numeric_limits<W>::max() / 2);
25 auto widen = [](
T value) -> W {
return value; };
26 auto clamp = [](W value) -> W {
return std::clamp<W>(value, min, max); };
27 auto check = [](W value) -> std::optional<W> {
if (value >= min && value <= max)
return value;
else return std::nullopt; };
#define Assert(val)
Identity function.
T ConsumeIntegralInRange(T min, T max)
#define T(expected, seed, data)
std::optional< T > CheckedAdd(const T i, const T j) noexcept
constexpr T SaturatingLeftShift(T input, unsigned shift) noexcept
Left bit shift with safe minimum and maximum values.
T SaturatingAdd(const T i, const T j) noexcept
constexpr std::optional< T > CheckedLeftShift(T input, unsigned shift) noexcept
Left bit shift with overflow checking.
FuzzedDataProvider & fuzzed_data_provider