summaryrefslogtreecommitdiff
path: root/firmware/export/system.h
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/export/system.h
parent3ad0879f19dc6086b90f23b5479e281953cb8417 (diff)
downloadrockbox-7c5f5f5c531481964a4a069a0b59a93618d62c91.tar.gz
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/export/system.h')
-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)
155 return oldlevel; 155 return oldlevel;
156} 156}
157 157
158static inline unsigned short SWAB16(unsigned short value)
159 /*
160 result[15..8] = value[ 7..0];
161 result[ 7..0] = value[15..8];
162 */
163{
164 return (value >> 8) | (value << 8);
165}
166
167static inline unsigned long SWAB32(unsigned long value)
168 /*
169 result[31..24] = value[ 7.. 0];
170 result[23..16] = value[15.. 8];
171 result[15.. 8] = value[23..16];
172 result[ 7.. 0] = value[31..24];
173 */
174{
175 unsigned short hi = SWAB16(value >> 16);
176 unsigned short lo = SWAB16(value & 0xffff);
177 return (lo << 16) | hi;
178}
179
158#endif 180#endif
159#endif 181#endif
160 182