diff options
author | Justin Berger <j.david.berger@gmail.com> | 2018-02-23 23:15:31 -0700 |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2018-02-23 23:30:16 -0700 |
commit | 9a9a539396c622246a527ed0c12df36edf5ff807 (patch) | |
tree | 9490c013fd3e73f207b18e5b5d3d8dfb8d0cbac5 /src/ootx_decoder.c | |
parent | 99deb0176b02d9a35114fefe951cdea50186a6ee (diff) | |
download | libsurvive-9a9a539396c622246a527ed0c12df36edf5ff807.tar.gz libsurvive-9a9a539396c622246a527ed0c12df36edf5ff807.tar.bz2 |
Fixed unaligned access issues
Diffstat (limited to 'src/ootx_decoder.c')
-rw-r--r-- | src/ootx_decoder.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index 7bf7d7e..ad55f5b 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -182,8 +182,13 @@ union iFloat { float f; }; + +struct __attribute__((__packed__)) unaligned_16_t { + uint16_t v; +}; + float _half_to_float(uint8_t* data) { - uint16_t x = *(uint16_t*)data; + uint16_t x = ((struct unaligned_16_t*)data)->v; union iFloat fnum; fnum.f = 0; |