summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-11-19 00:30:28 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-11-19 00:30:28 +0000
commit7c5f5f5c531481964a4a069a0b59a93618d62c91 (patch)
tree88061b0cabaa0f9d93c6e2fb6267619bffdb47ab /firmware
parent3ad0879f19dc6086b90f23b5479e281953cb8417 (diff)
downloadrockbox-7c5f5f5c531481964a4a069a0b59a93618d62c91.tar.gz
rockbox-7c5f5f5c531481964a4a069a0b59a93618d62c91.tar.bz2
rockbox-7c5f5f5c531481964a4a069a0b59a93618d62c91.zip
iRiver: SWAB16 and SWAB32 macros
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5433 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/system.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 1205e9360b..09efbeeda4 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -155,6 +155,28 @@ static inline int set_irq_level(int level)
return oldlevel;
}
+static inline unsigned short SWAB16(unsigned short value)
+ /*
+ result[15..8] = value[ 7..0];
+ result[ 7..0] = value[15..8];
+ */
+{
+ return (value >> 8) | (value << 8);
+}
+
+static inline unsigned long SWAB32(unsigned long value)
+ /*
+ result[31..24] = value[ 7.. 0];
+ result[23..16] = value[15.. 8];
+ result[15.. 8] = value[23..16];
+ result[ 7.. 0] = value[31..24];
+ */
+{
+ unsigned short hi = SWAB16(value >> 16);
+ unsigned short lo = SWAB16(value & 0xffff);
+ return (lo << 16) | hi;
+}
+
#endif
#endif