Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Namespaces | Functions
base_math.hpp File Reference
#include <cstdint>
#include <cmath>
#include <climits>
#include <jau/int_types.hpp>
#include <jau/int_math_ct.hpp>
Include dependency graph for base_math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  jau
 __pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
 

Functions

template<typename T , std::enable_if_t< std::is_arithmetic_v< T > &&!std::is_unsigned_v< T >, bool > = true>
constexpr T jau::abs (const T x) noexcept
 Returns the absolute value of an arithmetic number (w/ branching) in O(1) More...
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, bool > = true>
constexpr T jau::clamp (const T x, const T min_val, const T max_val) noexcept
 Returns constrained integral value to lie between given min- and maximum value (w/ branching) in O(1). More...
 
template<class T , std::enable_if_t< std::is_arithmetic_v< T >, bool > = true>
bool jau::in_range (const T &a, const T &b, const T &range)
 base_math: arithmetic types, i.e. More...
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T > &&!std::is_unsigned_v< T >, bool > = true>
constexpr T jau::invert_sign (const T x) noexcept
 Safely inverts the sign of an arithmetic number w/ branching in O(1) More...
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, bool > = true>
constexpr T jau::max (const T x, const T y) noexcept
 Returns the maximum of two integrals (w/ branching) in O(1) More...
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, bool > = true>
constexpr T jau::min (const T x, const T y) noexcept
 Returns the minimum of two integrals (w/ branching) in O(1) More...
 
template<typename T , std::enable_if_t< std::is_arithmetic_v< T > &&!std::is_unsigned_v< T >, bool > = true>
constexpr int jau::sign (const T x) noexcept
 Returns the value of the sign function (w/o branching ?) in O(1). More...