90 #error This file must be included from SYS_Types.h
100 #if defined(__F16C__) || defined(__AVX2__)
104 #include <immintrin.h>
188 bool isNormalized()
const;
189 bool isDenormalized()
const;
192 bool isInfinity()
const;
220 unsigned short bits()
const;
221 void setBits(
unsigned short bits);
224 static void ensureStaticDataIsInitialized();
242 static bool selftest();
262 SYS_API extern std::istream & operator >> (std::istream &is,
fpreal16 &h);
279 #define H_REAL16_MIN 5.96046448e-08 // Smallest +ve fpreal16
280 #define H_REAL16_NRM_MIN 6.10351562e-05 // Smallest +ve normalized fpreal16
282 #define H_REAL16_MAX 65504.0 // Largest positive fpreal16
285 #define H_REAL16_EPSILON 0.00097656
287 #define H_REAL16_MANT_DIG 11 // Number of digits in mantissa
290 #define H_REAL16_DIG 2 // Number of base 10 digits that
293 #define H_REAL16_RADIX 2 // Base of the exponent
295 #define H_REAL16_MIN_EXP -13 // Minimum negative integer such that
300 #define H_REAL16_MAX_EXP 16 // Maximum positive integer such that
305 #define H_REAL16_MIN_10_EXP -4 // Minimum positive integer such
309 #define H_REAL16_MAX_10_EXP 4 // Maximum positive integer such
433 #if defined(SYS_USE_F16C)
436 _h = _mm_extract_epi16 (
438 _mm_set_ss (f), (_MM_FROUND_TO_NEAREST_INT)),
442 _h = _cvtss_sh (f, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC));
476 int e = (x.
i >> 23) & 0x000001ff;
487 _h = e + (((x.
i & 0x007fffff) + 0x00001000) >> 13);
509 #if defined(SYS_USE_F16C)
517 return _mm_cvtss_f32 (_mm_cvtph_ps (_mm_set1_epi16 (_h)));
519 return _cvtsh_ss (_h);
522 return _toFloat[_h].f;
545 unsigned short s = _h & 0x8000;
546 unsigned short e = _h & 0x7fff;
673 unsigned short e = (_h >> 10) & 0x001f;
681 unsigned short e = (_h >> 10) & 0x001f;
682 return e > 0 && e < 31;
689 unsigned short e = (_h >> 10) & 0x001f;
690 unsigned short m = _h & 0x3ff;
691 return e == 0 && m != 0;
698 return (_h & 0x7fff) == 0;
705 unsigned short e = (_h >> 10) & 0x001f;
706 unsigned short m = _h & 0x3ff;
707 return e == 31 && m != 0;
714 unsigned short e = (_h >> 10) & 0x001f;
715 unsigned short m = _h & 0x3ff;
716 return e == 31 && m == 0;
723 return (_h & 0x8000) != 0;
780 #pragma push_macro("isnormal")
781 #pragma push_macro("isfinite")
782 #pragma push_macro("isinf")
783 #pragma push_macro("isnan")
798 #pragma pop_macro("isnormal")
799 #pragma pop_macro("isfinite")
800 #pragma pop_macro("isinf")
801 #pragma pop_macro("isnan")
OIIO_FORCEINLINE const vint4 & operator/=(vint4 &a, const vint4 &b)
SYS_API void SYSprintBits(std::ostream &os, fpreal16 h)
static const uif * _toFloat
IMATH_HOSTDEVICE constexpr Plane3< T > operator-(const Plane3< T > &plane) IMATH_NOEXCEPT
Reflect the pla.
fpreal16 operator-=(fpreal16 h)
fpreal16 operator-() const
Tto convert(const Tfrom &source)
fpreal16 operator/=(fpreal16 h)
bool isNegative(const Type &x)
Return true if x is less than zero.
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
fpreal16 operator*=(fpreal16 h)
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
#define SYS_DECLARE_IS_FLOATING_POINT(T)
Declare a type as floating point.
fpreal16 operator+=(fpreal16 h)
#define SYS_DECLARE_IS_POD(T)
Declare a type as POD.
bool isNan(const float x)
Return true if x is a NaN (Not-A-Number) value.
vfloat4 round(const vfloat4 &a)
GLboolean GLboolean GLboolean b
IMATH_HOSTDEVICE const Vec2< S > & operator*=(Vec2< S > &v, const Matrix22< T > &m) IMATH_NOEXCEPT
Vector-matrix multiplication: v *= m.
GLfloat GLfloat GLfloat GLfloat h
void setBits(unsigned short bits)
fpreal16 round(unsigned int n) const
LeafData & operator=(const LeafData &)=delete
fpreal16 & operator=(const fpreal16 &h)=default
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
unsigned short bits() const
static const unsigned short * _eLut
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
bool isNormalized() const
bool isFinite(const float x)
Return true if x is finite.
bool isDenormalized() const