include/SDL_endian.h
changeset 985 cec525374267
parent 859 6b28c91bf3d2
child 994 c4e5473672b6
equal deleted inserted replaced
984:44fd54a0ae5f 985:cec525374267
    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__)
       
    83 static __inline__ Uint16 SDL_Swap16(Uint16 x)
       
    84 {
       
    85 	__asm__("rorw #8,%0" : "=d" (x) :  "0" (x) : "cc");
       
    86 	return x;
       
    87 }
    82 #else
    88 #else
    83 static __inline__ Uint16 SDL_Swap16(Uint16 x) {
    89 static __inline__ Uint16 SDL_Swap16(Uint16 x) {
    84 	return((x<<8)|(x>>8));
    90 	return((x<<8)|(x>>8));
    85 }
    91 }
    86 #endif
    92 #endif
   104 
   110 
   105 	__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));
   106 	__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));
   107 	__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));
   108 	return result;
   114 	return result;
       
   115 }
       
   116 #elif defined(__GNUC__) && defined(__M68000__)
       
   117 static __inline__ Uint16 SDL_Swap32(Uint16 x)
       
   118 {
       
   119 	__asm__("rorw	#8,%0;\t\nswap	%0;\t\nror	#8,%0" : "=d" (x) :  "0" (x) : "cc");
       
   120 	return x;
   109 }
   121 }
   110 #else
   122 #else
   111 static __inline__ Uint32 SDL_Swap32(Uint32 x) {
   123 static __inline__ Uint32 SDL_Swap32(Uint32 x) {
   112 	return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
   124 	return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
   113 }
   125 }