summaryrefslogtreecommitdiff
path: root/apps/codecs/libalac
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libalac')
-rw-r--r--apps/codecs/libalac/alac.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/apps/codecs/libalac/alac.c b/apps/codecs/libalac/alac.c
index f94ff0fa9d..1f7867b648 100644
--- a/apps/codecs/libalac/alac.c
+++ b/apps/codecs/libalac/alac.c
@@ -166,46 +166,7 @@ static inline void unreadbits(alac_file *alac, int bits)
166 alac->input_buffer_bitaccumulator *= -1; 166 alac->input_buffer_bitaccumulator *= -1;
167} 167}
168 168
169/* ARMv5+ has a clz instruction equivalent to our function. 169#define count_leading_zeros(x) bs_generic(x, BS_CLZ|BS_SHORT)
170 */
171#if (defined(CPU_ARM) && (ARM_ARCH > 4))
172static inline int count_leading_zeros(uint32_t v)
173{
174 return __builtin_clz(v);
175}
176#else
177
178static const unsigned char bittab[16] ICONST_ATTR = {
179 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4
180};
181
182static inline int count_leading_zeros(int input)
183{
184 int output = 32;
185
186#if 0
187 /* Experimentation has shown that the following test is always false,
188 so we don't bother to perform it. */
189 if (input & 0xffff0000)
190 {
191 input >>= 16;
192 output -= 16;
193 }
194#endif
195 if (input & 0xff00)
196 {
197 input >>= 8;
198 output -= 8;
199 }
200 if (input & 0xf0)
201 {
202 input >>= 4;
203 output -= 4;
204 }
205 output -= bittab[input];
206 return output;
207}
208#endif
209 170
210void basterdised_rice_decompress(alac_file *alac, 171void basterdised_rice_decompress(alac_file *alac,
211 int32_t *output_buffer, 172 int32_t *output_buffer,