diff options
Diffstat (limited to 'apps/codecs/libfaad/common.c')
-rw-r--r-- | apps/codecs/libfaad/common.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/apps/codecs/libfaad/common.c b/apps/codecs/libfaad/common.c index debc125b3e..e8340d318d 100644 --- a/apps/codecs/libfaad/common.c +++ b/apps/codecs/libfaad/common.c | |||
@@ -241,58 +241,7 @@ uint32_t random_int(void) | |||
241 | return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); | 241 | return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); |
242 | } | 242 | } |
243 | 243 | ||
244 | uint32_t ones32(uint32_t x) | 244 | #define floor_log2(x) bs_generic(x, BS_LOG2) |
245 | { | ||
246 | x -= ((x >> 1) & 0x55555555); | ||
247 | x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); | ||
248 | x = (((x >> 4) + x) & 0x0f0f0f0f); | ||
249 | x += (x >> 8); | ||
250 | x += (x >> 16); | ||
251 | |||
252 | return (x & 0x0000003f); | ||
253 | } | ||
254 | |||
255 | uint32_t floor_log2(uint32_t x) | ||
256 | { | ||
257 | #if 1 | ||
258 | x |= (x >> 1); | ||
259 | x |= (x >> 2); | ||
260 | x |= (x >> 4); | ||
261 | x |= (x >> 8); | ||
262 | x |= (x >> 16); | ||
263 | |||
264 | return (ones32(x) - 1); | ||
265 | #else | ||
266 | uint32_t count = 0; | ||
267 | |||
268 | while (x >>= 1) | ||
269 | count++; | ||
270 | |||
271 | return count; | ||
272 | #endif | ||
273 | } | ||
274 | |||
275 | /* returns position of first bit that is not 0 from msb, | ||
276 | * starting count at lsb */ | ||
277 | uint32_t wl_min_lzc(uint32_t x) | ||
278 | { | ||
279 | #if 1 | ||
280 | x |= (x >> 1); | ||
281 | x |= (x >> 2); | ||
282 | x |= (x >> 4); | ||
283 | x |= (x >> 8); | ||
284 | x |= (x >> 16); | ||
285 | |||
286 | return (ones32(x)); | ||
287 | #else | ||
288 | uint32_t count = 0; | ||
289 | |||
290 | while (x >>= 1) | ||
291 | count++; | ||
292 | |||
293 | return (count + 1); | ||
294 | #endif | ||
295 | } | ||
296 | 245 | ||
297 | #ifdef FIXED_POINT | 246 | #ifdef FIXED_POINT |
298 | 247 | ||