include/SDL_endian.h
changeset 1044 d36ea7925763
parent 1033 aebfa3ce2a53
child 1312 c9b51268668f
equal deleted inserted replaced
1043:21d1d05aad39 1044:d36ea7925763
    77 	Uint16 result;
    77 	Uint16 result;
    78 
    78 
    79 	__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
    79 	__asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
    80 	return result;
    80 	return result;
    81 }
    81 }
    82 #elif defined(__GNUC__) && defined(__M68000__)
    82 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
    83 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    83 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    84 {
    84 {
    85 	__asm__("rorw #8,%0" : "=d" (x) :  "0" (x) : "cc");
    85 	__asm__("rorw #8,%0" : "=d" (x) :  "0" (x) : "cc");
    86 	return x;
    86 	return x;
    87 }
    87 }
   111 	__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
   111 	__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
   112 	__asm__("rlwimi %0,%2,8,8,15"   : "=&r" (result) : "0" (result),    "r" (x));
   112 	__asm__("rlwimi %0,%2,8,8,15"   : "=&r" (result) : "0" (result),    "r" (x));
   113 	__asm__("rlwimi %0,%2,24,0,7"   : "=&r" (result) : "0" (result),    "r" (x));
   113 	__asm__("rlwimi %0,%2,24,0,7"   : "=&r" (result) : "0" (result),    "r" (x));
   114 	return result;
   114 	return result;
   115 }
   115 }
   116 #elif defined(__GNUC__) && defined(__M68000__)
   116 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
   117 static __inline__ Uint32 SDL_Swap32(Uint32 x)
   117 static __inline__ Uint32 SDL_Swap32(Uint32 x)
   118 {
   118 {
   119 	__asm__("rorw	#8,%0\n\tswap	%0\n\tror	#8,%0" : "=d" (x) :  "0" (x) : "cc");
   119 	__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) :  "0" (x) : "cc");
   120 	return x;
   120 	return x;
   121 }
   121 }
   122 #else
   122 #else
   123 static __inline__ Uint32 SDL_Swap32(Uint32 x) {
   123 static __inline__ Uint32 SDL_Swap32(Uint32 x) {
   124 	return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
   124 	return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));