59 operator float()
const
78 unsigned int float_value = ((hf & 0x8000) << 16) | (((hf & 0x7c00) + 0x1C000) << 13) | ((hf & 0x03FF) << 13);
79 void *ptr =
static_cast<void*
>(&float_value);
80 return *
static_cast<float*
>(ptr);
86 void *ptr =
static_cast<void*
>(&float_value);
87 unsigned int f = *
static_cast<unsigned int*
>(ptr);
88 return ((f >> 16) & 0x8000) | ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | ((f >> 13) & 0x03ff);
93 unsigned int float_value = mantissa_table[offset_table[hf >> 10] + (hf & 0x3ff)] + exponent_table[hf >> 10];
94 void *ptr =
static_cast<void*
>(&float_value);
95 return *
static_cast<float*
>(ptr);
100 void *ptr =
static_cast<void*
>(&float_value);
101 unsigned int f = *
static_cast<unsigned int*
>(ptr);
102 return base_table[(f >> 23) & 0x1ff] + ((f & 0x007fffff) >> shift_table[(f >> 23) & 0x1ff]);
106 unsigned short value;
108 static unsigned int mantissa_table[2048];
109 static unsigned int exponent_table[64];
110 static unsigned short offset_table[64];
112 static unsigned short base_table[512];
113 static unsigned char shift_table[512];
Definition: half_float.h:33
static float half_to_float_simple(unsigned short hf)
Only works for 'normal' half-float values.
Definition: half_float.h:76
HalfFloat & operator=(const HalfFloat &other)
Definition: half_float.h:48
HalfFloat(float v)
Definition: half_float.h:44
HalfFloat()
Definition: half_float.h:36
static unsigned short float_to_half(float float_value)
Definition: half_float.h:98
HalfFloat & from_float(float v)
Definition: half_float.h:69
float to_float() const
Definition: half_float.h:64
static unsigned short float_to_half_simple(float float_value)
Only works for 'normal' half-float values.
Definition: half_float.h:84
HalfFloat(const HalfFloat &other)
Definition: half_float.h:40
static float half_to_float(unsigned short hf)
Definition: half_float.h:91
Definition: Application/application.h:35