forked from len0rd/rockbox
Make voicefont produce proper files on big endian machines.
Voicefont writes most data as integer values which need bitswapping depending on the architecture. Fixes voicefont creating invalid files on OS X PPC. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25160 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1759a299f1
commit
efeb43b341
1 changed files with 6 additions and 1 deletions
|
@ -32,12 +32,16 @@
|
||||||
#define HEADER_SIZE 20
|
#define HEADER_SIZE 20
|
||||||
|
|
||||||
/* endian conversion macros */
|
/* endian conversion macros */
|
||||||
|
#if defined(__BIG_ENDIAN__)
|
||||||
|
#define SWAP2(x) (x)
|
||||||
|
#define SWAP4(x) (x)
|
||||||
|
#else
|
||||||
#define SWAP2(x) ((((unsigned)(x)>>8) & 0x00ff) | (((unsigned)(x)<<8) & 0xff00))
|
#define SWAP2(x) ((((unsigned)(x)>>8) & 0x00ff) | (((unsigned)(x)<<8) & 0xff00))
|
||||||
#define SWAP4(x) ((((unsigned)(x)>>24) & 0x000000ff) |\
|
#define SWAP4(x) ((((unsigned)(x)>>24) & 0x000000ff) |\
|
||||||
(((unsigned)(x)>>8) & 0x0000ff00) |\
|
(((unsigned)(x)>>8) & 0x0000ff00) |\
|
||||||
(((unsigned)(x)<<8) & 0x00ff0000) |\
|
(((unsigned)(x)<<8) & 0x00ff0000) |\
|
||||||
(((unsigned)(x)<<24) & 0xff000000))
|
(((unsigned)(x)<<24) & 0xff000000))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* bitswap audio bytes, LSB becomes MSB and vice versa */
|
/* bitswap audio bytes, LSB becomes MSB and vice versa */
|
||||||
int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
|
int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
|
||||||
|
@ -247,3 +251,4 @@ int main (int argc, char** argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue