diff options
Diffstat (limited to 'apps/codecs/demac/libdemac/rangecoding.h')
-rw-r--r-- | apps/codecs/demac/libdemac/rangecoding.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/codecs/demac/libdemac/rangecoding.h b/apps/codecs/demac/libdemac/rangecoding.h index c96886e32b..645fd1ad92 100644 --- a/apps/codecs/demac/libdemac/rangecoding.h +++ b/apps/codecs/demac/libdemac/rangecoding.h | |||
@@ -49,6 +49,14 @@ removing the rc parameter from each function (and the RNGC macro)). | |||
49 | 49 | ||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #ifdef ROCKBOX | ||
53 | #include "../lib/codeclib.h" | ||
54 | /* for UDIV32() */ | ||
55 | #endif | ||
56 | |||
57 | #ifndef UDIV32 | ||
58 | #define UDIV32(a, b) (a / b) | ||
59 | #endif | ||
52 | 60 | ||
53 | /* BITSTREAM READING FUNCTIONS */ | 61 | /* BITSTREAM READING FUNCTIONS */ |
54 | 62 | ||
@@ -121,15 +129,15 @@ static inline void range_dec_normalize(void) | |||
121 | static inline int range_decode_culfreq(int tot_f) | 129 | static inline int range_decode_culfreq(int tot_f) |
122 | { | 130 | { |
123 | range_dec_normalize(); | 131 | range_dec_normalize(); |
124 | rc.help = rc.range / tot_f; | 132 | rc.help = UDIV32(rc.range, tot_f); |
125 | return rc.low / rc.help; | 133 | return UDIV32(rc.low, rc.help); |
126 | } | 134 | } |
127 | 135 | ||
128 | static inline int range_decode_culshift(int shift) | 136 | static inline int range_decode_culshift(int shift) |
129 | { | 137 | { |
130 | range_dec_normalize(); | 138 | range_dec_normalize(); |
131 | rc.help = rc.range >> shift; | 139 | rc.help = rc.range >> shift; |
132 | return rc.low / rc.help; | 140 | return UDIV32(rc.low, rc.help); |
133 | } | 141 | } |
134 | 142 | ||
135 | 143 | ||