… | |
… | |
878 | ecb_function_ ecb_const uint16_t ecb_binary32_to_binary16 (uint32_t x); |
878 | ecb_function_ ecb_const uint16_t ecb_binary32_to_binary16 (uint32_t x); |
879 | ecb_function_ ecb_const uint16_t |
879 | ecb_function_ ecb_const uint16_t |
880 | ecb_binary32_to_binary16 (uint32_t x) |
880 | ecb_binary32_to_binary16 (uint32_t x) |
881 | { |
881 | { |
882 | unsigned int s = (x >> 16) & 0x00008000; /* sign bit, the easy part */ |
882 | unsigned int s = (x >> 16) & 0x00008000; /* sign bit, the easy part */ |
883 | unsigned int e = ((x >> 23) & 0x000000ff) - (127 - 15); /* the desired exponent */ |
883 | int e = ((x >> 23) & 0x000000ff) - (127 - 15); /* the desired exponent */ |
884 | unsigned int m = x & 0x007fffff; |
884 | unsigned int m = x & 0x007fffff; |
885 | |
885 | |
886 | x &= 0x7fffffff; |
886 | x &= 0x7fffffff; |
887 | |
887 | |
888 | /* if it's within range of binary16 normals, use fast path */ |
888 | /* if it's within range of binary16 normals, use fast path */ |