Index: src/OFMacros.h ================================================================== --- src/OFMacros.h +++ src/OFMacros.h @@ -29,18 +29,22 @@ #ifdef __GNUC__ #if defined(__amd64__) || defined(__x86_64__) #define OF_AMD64_ASM #elif defined(__i386__) #define OF_X86_ASM +#elif defined(__ppc__) || defined(__PPC__) +#define OF_PPC_ASM #endif #endif static OF_INLINE uint16_t OF_BSWAP16(uint16_t i) { #if defined(OF_X86_ASM) || defined(OF_AMD64_ASM) asm("xchgb %h0, %b0" : "=Q"(i) : "Q"(i)); +#elif defined(OF_PPC_ASM) + asm("lhbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i)); #else i = (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; #endif return i; @@ -49,10 +53,12 @@ static OF_INLINE uint32_t OF_BSWAP32(uint32_t i) { #if defined(OF_X86_ASM) || defined(OF_AMD64_ASM) asm("bswap %0" : "=q"(i) : "q"(i)); +#elif defined(OF_PPC_ASM) + asm("lwbrx %0, 0, %1" : "=r"(i) : "r"(&i), "m"(i)); #else i = (i & UINT32_C(0xFF000000)) >> 24 | (i & UINT32_C(0x00FF0000)) >> 8 | (i & UINT32_C(0x0000FF00)) << 8 | (i & UINT32_C(0x000000FF)) << 24;