aboutsummaryrefslogtreecommitdiff
path: root/src/ootx_decoder.c
diff options
context:
space:
mode:
authorAbhijeet Vhotkar <abhijeetvhotkar@gmail.com>2018-03-10 18:16:29 -0500
committerGitHub <noreply@github.com>2018-03-10 18:16:29 -0500
commit9a34826efbab3d5fa9dbb9cf837c392395c7ef79 (patch)
tree6011fe431de4393c9212b4d5db78759080d65509 /src/ootx_decoder.c
parente5a9bff729fb0c596daed5cdf45683e11c666766 (diff)
parentc687e3ea63a5d974fd35feb07fe7fb87d4375e6a (diff)
downloadlibsurvive-9a34826efbab3d5fa9dbb9cf837c392395c7ef79.tar.gz
libsurvive-9a34826efbab3d5fa9dbb9cf837c392395c7ef79.tar.bz2
Merge pull request #1 from cnlohr/master
Pulling new changes
Diffstat (limited to 'src/ootx_decoder.c')
-rw-r--r--src/ootx_decoder.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c
index f7a7938..b7327d5 100644
--- a/src/ootx_decoder.c
+++ b/src/ootx_decoder.c
@@ -44,7 +44,7 @@ void ootx_free_decoder_context(ootx_decoder_context *ctx) {
}
uint8_t ootx_decode_bit(uint32_t length) {
- uint8_t t = (length - 2750) / 500; //why 2750?
+ uint8_t t = (uint8_t)((length - 2750) / 500); //why 2750?
// return ((t & 0x02)>0)?0xFF:0x00; //easier if we need to bitshift right
return ((t & 0x02)>>1);
}
@@ -182,8 +182,13 @@ union iFloat {
float f;
};
+
+struct __attribute__((__packed__)) unaligned_u16_t {
+ uint16_t v;
+};
+
float _half_to_float(uint8_t* data) {
- uint16_t x = *(uint16_t*)data;
+ uint16_t x = ((struct unaligned_u16_t*)data)->v;
union iFloat fnum;
fnum.f = 0;