aboutsummaryrefslogtreecommitdiff
path: root/src/ootx_decoder.c
diff options
context:
space:
mode:
authorCNLohr <charles@cnlohr.com>2018-02-24 12:26:32 -0500
committerGitHub <noreply@github.com>2018-02-24 12:26:32 -0500
commit3fbd36f71cfe168ada14b8f58f023bb05e4d322b (patch)
tree0d830ad923f207d74cc8493e35757f22fc02369a /src/ootx_decoder.c
parent4da907623f5ce8a71ab9f5ec60112df45060b2aa (diff)
parentdabb0764a080ad219e1bb477e8cf7386a1a4dc7c (diff)
downloadlibsurvive-3fbd36f71cfe168ada14b8f58f023bb05e4d322b.tar.gz
libsurvive-3fbd36f71cfe168ada14b8f58f023bb05e4d322b.tar.bz2
Merge pull request #99 from jdavidberger/misc-bugfix
Fixed two minor / potential bugs
Diffstat (limited to 'src/ootx_decoder.c')
-rw-r--r--src/ootx_decoder.c7
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;