include/SDL_endian.h
changeset 859 6b28c91bf3d2
parent 849 bab227101de4
child 985 cec525374267
equal deleted inserted replaced
858:5db50aa5bf08 859:6b28c91bf3d2
    69 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    69 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    70 {
    70 {
    71 	__asm__("xchgb %b0,%h0" : "=q" (x) :  "0" (x));
    71 	__asm__("xchgb %b0,%h0" : "=q" (x) :  "0" (x));
    72 	return x;
    72 	return x;
    73 }
    73 }
    74 #elif defined(__GNUC__) && defined(__powerpc__)
    74 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
    75 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    75 static __inline__ Uint16 SDL_Swap16(Uint16 x)
    76 {
    76 {
    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));
    95 static __inline__ Uint32 SDL_Swap32(Uint32 x)
    95 static __inline__ Uint32 SDL_Swap32(Uint32 x)
    96 {
    96 {
    97 	__asm__("bswapl %0" : "=r" (x) : "0" (x));
    97 	__asm__("bswapl %0" : "=r" (x) : "0" (x));
    98 	return x;
    98 	return x;
    99 }
    99 }
   100 #elif defined(__GNUC__) && defined(__powerpc__)
   100 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
   101 static __inline__ Uint32 SDL_Swap32(Uint32 x)
   101 static __inline__ Uint32 SDL_Swap32(Uint32 x)
   102 {
   102 {
   103 	Uint32 result;
   103 	Uint32 result;
   104 
   104 
   105 	__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
   105 	__asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));