Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Go to the documentation of this file.
26 #ifndef JAU_BASIC_INT_MATH_HPP_
27 #define JAU_BASIC_INT_MATH_HPP_
57 return (T(0) < x) - (x < T(0));
87 return std::numeric_limits<T>::min() == x ? std::numeric_limits<T>::max() : -x;
100 constexpr T
abs(
const T x) noexcept
102 return sign(x) < 0 ? invert_sign<T>( x ) : x;
130 return 1 +
static_cast<nsize_t>( std::log10<T>( invert_sign<T>( x ) ) ) + ( sign_is_digit ? 1 : 0 );
132 return 1 +
static_cast<nsize_t>( std::log10<T>( x ) );
153 return digits10<T>(x, jau::sign<T>(x), sign_is_digit);
constexpr snsize_t sign(const T x) noexcept
Returns the value of the sign function.
constexpr T abs(const T x) noexcept
Returns the absolute value of an integral number.
constexpr T invert_sign(const T x) noexcept
Safely inverts the sign of an integral number.
int_fast32_t snsize_t
Natural 'ssize_t' alternative using int_fast32_t as its natural sized type.
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
constexpr nsize_t digits10(const T x, const snsize_t x_sign, const bool sign_is_digit=true) noexcept
Returns the number of decimal digits of the given integral value number using std::log10<T>().