MySQL 9.1.0
Source Code Documentation
bounded_arithmetic.h File Reference
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  mysql
 
namespace  mysql::math
 

Functions

template<typename T , std::enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value, bool > = true>
constexpr T mysql::math::add_bounded (const T x, const T y, const T maximum)
 Return x+y, limited to the given maximum. More...
 
template<typename T , typename T2 , std::enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value &&std::is_arithmetic< T2 >::value, bool > = true>
constexpr T mysql::math::multiply_bounded (const T x, const T2 y, const T maximum)
 Return x*y, limited to the given maximum. More...
 
template<typename T , std::enable_if_t< std::is_integral< T >::value &&std::is_unsigned< T >::value, bool > = true>
constexpr T mysql::math::ceil_div (const T x, const T y)
 Return ceil(x / y), where x and y are unsigned integer types. More...