Mercurial > audlegacy-plugins
changeset 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 | 169f6ee38cad |
children | 281fc9f7f126 |
files | src/aac/libfaad2/bits.c src/aac/libfaad2/bits.h |
diffstat | 2 files changed, 33 insertions(+), 33 deletions(-) [+] |
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) {
--- a/src/aac/libfaad2/bits.h Wed Apr 08 22:30:45 2009 +0100 +++ b/src/aac/libfaad2/bits.h Wed Apr 08 22:38:23 2009 +0100 @@ -107,39 +107,6 @@ return tmp; } -/* 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; -} - static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) { if (bits <= ld->bits_left)