mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
iRiver: SWAB16 and SWAB32 macros
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5433 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3ad0879f19
commit
7c5f5f5c53
1 changed files with 22 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue