#pragma once
|
|
|
|
namespace gp {
|
|
namespace math {
|
|
template<typename T>
|
|
constexpr T pi;
|
|
|
|
template<typename T>
|
|
T abs(T);
|
|
|
|
template<typename word_t>
|
|
word_t log2(word_t v);
|
|
|
|
/**
|
|
* @brief Returns \f$n\f$ so that it is the smallest value that matches for \f$v\leq{}log2(2^n)\f$
|
|
*
|
|
* @tparam word_t
|
|
* @param v
|
|
* @return constexpr word_t
|
|
*/
|
|
template<typename word_t>
|
|
constexpr word_t msb(word_t v);
|
|
|
|
/**
|
|
* @brief Reads the sign of a value
|
|
*
|
|
* @tparam T
|
|
* @return -1 if the value is negative
|
|
* @return 0 if the value is 0 or not a number
|
|
* @return 1 if the value is positive
|
|
*/
|
|
template<typename T>
|
|
T sign(T);
|
|
}
|
|
}
|