20 #include <immintrin.h>
27 #warning "float16_t type is not supported, using manual implementations"
55 uint32_t hexpmant = ((uint32_t) (h) << 17) >> 4;
56 v.
i = ((uint32_t) (h >> 15)) << 31;
59 if ((hexpmant >= 0x00800000)) {
63 if ((hexpmant < 0x0f800000)) {
70 else if (hexpmant != 0) {
78 while (0 == ((hexpmant << lc) & 0x80000000)) {
94 v.
i |= (hexpmant << lc);
118 uint32_t e, m, ui, r, shift;
122 ui = (v.
i & ~0x80000000);
123 ret = ((v.
i >> 16) & 0x8000);
126 if (ui >= 0x38800000) {
128 if (ui >= 0x7f800000) {
130 if (ui == 0x7f800000) {
133 m = (ui & 0x7fffff) >> 13;
135 return ret | (uint16_t) m | (uint16_t) (m == 0);
139 if (ui > 0x477fefff) {
144 ui = ((ui + 0x00000fff + ((ui >> 13) & 1)) >> 13);
145 return ret | (uint16_t) ui;
149 if (ui < 0x33000001) {
156 m = 0x800000 | (ui & 0x7fffff);
157 r = m << (32 - shift);
159 if (r > 0x80000000 || (r == 0x80000000 && (ret & 0x1) != 0)) {
uint16_t float16_t
Definition: float16.h:33
static float16_t as_f16(float f)
Definition: float16.h:108
static float as_f32(float16_t h)
Definition: float16.h:42
float f
Definition: float16.h:30
uint32_t i
Definition: float16.h:29