aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJosh Allen <axlecrusher@gmail.com>2017-02-12 10:05:58 -0500
committerJosh Allen <axlecrusher@gmail.com>2017-02-12 10:05:58 -0500
commit12fd01346d92d24f9e6ecd89c57e25cdaa455e12 (patch)
tree3405547516033d937165ec471ca342dadcd8083e /tools
parentda93d5821e6da8462ff42f2c8e6e07a3cbe10740 (diff)
downloadlibsurvive-12fd01346d92d24f9e6ecd89c57e25cdaa455e12.tar.gz
libsurvive-12fd01346d92d24f9e6ecd89c57e25cdaa455e12.tar.bz2
remove float16 to float32 conversion
Diffstat (limited to 'tools')
-rw-r--r--tools/ootx_decode/ootx_decoder.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/tools/ootx_decode/ootx_decoder.c b/tools/ootx_decode/ootx_decoder.c
index 6c5031c..fb87e41 100644
--- a/tools/ootx_decode/ootx_decoder.c
+++ b/tools/ootx_decode/ootx_decoder.c
@@ -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) {