summaryrefslogtreecommitdiffstats
path: root/tools/voicefont.c
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-13 23:34:19 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-13 23:34:19 +0000
commitefeb43b3415f367f110e1b25c9ada1b6478d6325 (patch)
tree82c0c33ac5526830ed69f0224dbbf05bdf11b6ab /tools/voicefont.c
parent1759a299f103982f79bcf5cc450152fd33ffcb1b (diff)
downloadrockbox-efeb43b3415f367f110e1b25c9ada1b6478d6325.tar.gz
rockbox-efeb43b3415f367f110e1b25c9ada1b6478d6325.tar.bz2
rockbox-efeb43b3415f367f110e1b25c9ada1b6478d6325.zip
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
Diffstat (limited to 'tools/voicefont.c')
-rw-r--r--tools/voicefont.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/voicefont.c b/tools/voicefont.c
index 4da67fabed..13ce4bfca2 100644
--- a/tools/voicefont.c
+++ b/tools/voicefont.c
@@ -32,12 +32,16 @@
#define HEADER_SIZE 20
/* 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 SWAP4(x) ((((unsigned)(x)>>24) & 0x000000ff) |\
(((unsigned)(x)>>8) & 0x0000ff00) |\
(((unsigned)(x)<<8) & 0x00ff0000) |\
(((unsigned)(x)<<24) & 0xff000000))
-
+#endif
/* bitswap audio bytes, LSB becomes MSB and vice versa */
int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
@@ -247,3 +251,4 @@ int main (int argc, char** argv)
return 0;
}
#endif
+