Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos] / src / kernel / ao_fec_rx.c
index 8e4a852221aac60e869576348acae5bab01dab51..ecbb21ac6847c32ad2f4820df4822f05fc0e1160 100644 (file)
@@ -59,7 +59,7 @@ static const uint8_t ao_interleave_order[] = {
 };
 
 static inline uint16_t ao_interleave_index(uint16_t i) {
-       return (i & ~0x1e) | ao_interleave_order[(i & 0x1e) >> 1];
+       return (uint16_t) ((i & ~0x1e) | ao_interleave_order[(i & 0x1e) >> 1]);
 }
 
 #define NUM_STATE      8
@@ -262,7 +262,7 @@ ao_fec_decode(const uint8_t *in, uint16_t len, uint8_t *out, uint8_t out_len, ui
                         * the end of the input, in which case
                         * it will be seven.
                         */
-                       int8_t          dist = b - (o + 8);     /* distance to last ready-for-writing bit */
+                       int8_t          dist = (int8_t) (b - (o + 8));  /* distance to last ready-for-writing bit */
                        uint32_t        min_cost;               /* lowest cost */
                        uint8_t         min_state;              /* lowest cost state */
                        uint8_t         byte;
@@ -293,7 +293,7 @@ ao_fec_decode(const uint8_t *in, uint16_t len, uint8_t *out, uint8_t out_len, ui
                        printf ("\tbit %3d min_cost %5d old bit %3d old_state %x bits %02x whiten %0x\n",
                                i/2, min_cost, o + 8, min_state, (bits[p][min_state] >> dist) & 0xff, *whiten);
 #endif
-                       byte = (bits[p][min_state] >> dist) ^ *whiten++;
+                       byte = (uint8_t) ((bits[p][min_state] >> dist) ^ *whiten++);
                        *out++ = byte;
                        if (out_len > 2)
                                crc = ao_fec_crc_byte(byte, crc);