26#ifndef MYSQL_MATH_BOUNDED_ARITHMETIC_H
27#define MYSQL_MATH_BOUNDED_ARITHMETIC_H
55 if (y >= maximum || maximum - y < x)
return maximum;
79 typename T,
typename T2,
85 if (y > 1 &&
static_cast<T>(maximum / y) < x)
return maximum;
86 return static_cast<T>(x * y);
94 return (x + y - 1) / y;
#define T
Definition: jit_executor_value.cc:373
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
Definition: bounded_arithmetic.h:34
constexpr T multiply_bounded(const T x, const T2 y, const T maximum)
Return x*y, limited to the given maximum.
Definition: bounded_arithmetic.h:83
constexpr T ceil_div(const T x, const T y)
Return ceil(x / y), where x and y are unsigned integer types.
Definition: bounded_arithmetic.h:93
constexpr T add_bounded(const T x, const T y, const T maximum)
Return x+y, limited to the given maximum.
Definition: bounded_arithmetic.h:54