General Purpose library for Freestanding C++ and POSIX systems
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

35 行
729 B

#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);
}
}