remove float16 to float32 conversion
@@ -252,36 +252,8 @@ uint8_t* get_ptr(uint8_t* data, uint8_t bytes, uint16_t* idx) {
}
float _to_float(uint8_t* data) {
- uint16_t h = *(uint16_t*)(data);
- uint16_t h_exp, h_sig;
- uint32_t f_sgn, f_exp, f_sig;
-
- h_exp = (h&0x7c00u);
- f_sgn = ((uint32_t)h&0x8000u) << 16;
- if (h_exp == 0x0000u) { /* 0 or subnormal */
- h_sig = (h&0x03ffu);
- /* Signed zero */
- if (h_sig == 0) {
- return f_sgn;
- }
- /* Subnormal */
- h_sig <<= 1;
- while ((h_sig&0x0400u) == 0) {
- h_sig <<= 1;
- h_exp++;
- }
- f_exp = ((uint32_t)(127 - 15 - h_exp)) << 23;
- f_sig = ((uint32_t)(h_sig&0x03ffu)) << 13;
- return f_sgn + f_exp + f_sig;
- }
- else if (h_exp == 0x7c00u) { /* inf or NaN */
- /* All-ones exponent and a copy of the significand */
- return f_sgn + 0x7f800000u + (((uint32_t)(h&0x03ffu)) << 13);
- }
- else { /* normalized */
- /* Just need to adjust the exponent and shift */
- return f_sgn + (((uint32_t)(h&0x7fffu) + 0x1c000u) << 13);
- }
+ uint16_t x = *(uint16_t*)data;
+ return x;
}
void init_lighthouse_info_v6(lighthouse_info_v6* lhi, uint8_t* data) {
