Add m68k assembly routines for endianness conversion
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40986
This commit is contained in:
parent
42648118e4
commit
9e6a139081
1 changed files with 12 additions and 0 deletions
|
@ -79,6 +79,12 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#elif defined(__GNUC__) && defined(__M68000__)
|
||||||
|
static __inline__ Uint16 SDL_Swap16(Uint16 x)
|
||||||
|
{
|
||||||
|
__asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||||
|
return x;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
static __inline__ Uint16 SDL_Swap16(Uint16 x) {
|
||||||
return((x<<8)|(x>>8));
|
return((x<<8)|(x>>8));
|
||||||
|
@ -107,6 +113,12 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x)
|
||||||
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
__asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#elif defined(__GNUC__) && defined(__M68000__)
|
||||||
|
static __inline__ Uint16 SDL_Swap32(Uint16 x)
|
||||||
|
{
|
||||||
|
__asm__("rorw #8,%0;\t\nswap %0;\t\nror #8,%0" : "=d" (x) : "0" (x) : "cc");
|
||||||
|
return x;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
static __inline__ Uint32 SDL_Swap32(Uint32 x) {
|
||||||
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue