diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2007-03-22 15:53:37 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2007-03-22 15:53:37 +0000 |
commit | 149a7bab5bcd835a7370c3ae19a6d193a0d92e84 (patch) | |
tree | 5bc5d485ab5af86ce0a876f962ee8c9bc4874dc2 /tools/descramble.c | |
parent | e5b77b1a47fb99c616f3ba9045d79120fd491fab (diff) |
Make Gigabeat's scramble endian-safe.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12892 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/descramble.c')
-rw-r--r-- | tools/descramble.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/descramble.c b/tools/descramble.c index c993c9f25e..9d45b8c0dc 100644 --- a/tools/descramble.c +++ b/tools/descramble.c @@ -26,6 +26,21 @@ int iaudio_decode(char *iname, char *oname); +unsigned int le2int(unsigned char* buf) +{ + int32_t res = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]; + + return res; +} + +void int2le(unsigned int val, unsigned char* addr) +{ + addr[0] = val & 0xFF; + addr[1] = (val >> 8) & 0xff; + addr[2] = (val >> 16) & 0xff; + addr[3] = (val >> 24) & 0xff; +} + void usage(void) { printf("usage: descramble [options] <input file> <output file>\n"); |