1#ifndef NEFORCE_CORE_NUMERIC_NUMERIC_TYPES_HPP__
2#define NEFORCE_CORE_NUMERIC_NUMERIC_TYPES_HPP__
14NEFORCE_BEGIN_NAMESPACE__
38 const UInt bits = *
reinterpret_cast<const UInt*
>(&x);
39 constexpr UInt sign_mask =
static_cast<UInt
>(1) << (8 *
sizeof(UInt) - 1);
40 return (bits & sign_mask) != 0;
52 return (buf.data[9] & 0x80) != 0;
65NEFORCE_CONST_FUNCTION
constexpr bool is_nan(
const T x)
noexcept {
102NEFORCE_CONST_FUNCTION
constexpr bool is_infinity(
const T x)
noexcept {
115NEFORCE_CONST_FUNCTION
constexpr bool is_finite(
const T x)
noexcept {
129NEFORCE_CONST_FUNCTION
constexpr bool is_normal(
const T x)
noexcept {
136 const T abs = x < 0 ? -x : x;
150NEFORCE_CONST_FUNCTION
constexpr bool is_subnormal(
const T x)
noexcept {
157 const T abs = x < 0 ? -x : x;
158 return abs < numeric_traits<T>::min();
172NEFORCE_CONST_FUNCTION
constexpr bool is_positive(
const T x)
noexcept {
173 return x > 0 || (x == 0 && !_NEFORCE
signbit(x));
187NEFORCE_CONST_FUNCTION
constexpr bool is_negative(
const T x)
noexcept {
188 return x < 0 || (x == 0 && _NEFORCE
signbit(x));
193NEFORCE_END_NAMESPACE__
static constexpr T infinity() noexcept
获取正无穷大表示
static constexpr T min() noexcept
获取类型的最小值
constexpr bool is_floating_point_v
is_floating_point的便捷变量模板
unsigned char byte_t
字节类型,定义为无符号字符
constexpr void * memory_copy(void *NEFORCE_RESTRICT dest, const void *NEFORCE_RESTRICT src, size_t count) noexcept
从源内存复制到目标内存
constexpr bool is_subnormal(const T x) noexcept
检查浮点数是否为次正规数
constexpr bool is_infinity(const T x) noexcept
检查浮点数是否为无穷大
constexpr enable_if_t<!(sizeof(T)==16 &&numeric_traits< T >::digits==64), bool > signbit(const T x) noexcept
获取浮点数的符号位
constexpr bool is_neg_infinity(const T x) noexcept
检查浮点数是否为负无穷大
constexpr bool is_nan(const T x) noexcept
检查浮点数是否为NaN
constexpr bool is_pos_infinity(const T x) noexcept
检查浮点数是否为正无穷大
constexpr bool is_negative(const T x) noexcept
检查浮点数是否为负数
constexpr bool is_finite(const T x) noexcept
检查浮点数是否为有限值
constexpr bool is_normal(const T x) noexcept
检查浮点数是否为正规数
constexpr bool is_positive(const T x) noexcept
检查浮点数是否为正数
typename make_integer< Size, IsSigned >::type make_integer_t
make_integer的便捷别名
constexpr decltype(auto) data(Container &cont) noexcept(noexcept(cont.data()))
获取容器的底层数据指针
typename enable_if< Test, T >::type enable_if_t
enable_if的便捷别名