Mercurial > audlegacy-plugins
diff src/aac/libfaad2/bits.c @ 3007:7a7060caef14
Yes, and another of those "inline" functions moved to where it belongs.
| author | Tony Vroon <chainsaw@gentoo.org> |
|---|---|
| date | Wed, 08 Apr 2009 22:38:23 +0100 |
| parents | 8867d3491f60 |
| children |
line wrap: on
line diff
--- a/src/aac/libfaad2/bits.c Wed Apr 08 22:30:45 2009 +0100 +++ b/src/aac/libfaad2/bits.c Wed Apr 08 22:38:23 2009 +0100 @@ -34,6 +34,39 @@ #include <stdlib.h> #include "bits.h" +/* reads only n bytes from the stream instead of the standard 4 */ +static /*INLINE*/ uint32_t getdword_n(void *mem, int n) +{ + uint32_t tmp = 0; +#ifndef ARCH_IS_BIG_ENDIAN + switch (n) + { + case 3: + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; + case 2: + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; + case 1: + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; + default: + break; + } +#else + switch (n) + { + case 3: + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; + case 2: + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; + case 1: + ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; + default: + break; + } +#endif + + return tmp; +} + /* initialize buffer, call once before first getbits or showbits */ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) {
