diff --git a/misc.h b/misc.h index d6cd4212..28f2e972 100644 --- a/misc.h +++ b/misc.h @@ -1775,10 +1775,7 @@ inline byte ByteReverse(byte value) //! \details ByteReverse calls bswap if available. Otherwise the function performs a 8-bit rotate on the word16 inline word16 ByteReverse(word16 value) { -#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE) - __asm__ ("movbe %1, %0" : "=m" (value) : "q" (value)); - return value; -#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE) +#if defined(CRYPTOPP_BYTESWAP_AVAILABLE) return bswap_16(value); #elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL)) return _byteswap_ushort(value); @@ -1792,10 +1789,7 @@ inline word16 ByteReverse(word16 value) //! \details ByteReverse calls bswap if available. Otherwise the function uses a combination of rotates on the word32 inline word32 ByteReverse(word32 value) { -#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE) - __asm__ ("movbe %1, %0" : "=m" (value) : "q" (value)); - return value; -#elif defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) +#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) __asm__ ("bswap %0" : "=r" (value) : "0" (value)); return value; #elif defined(CRYPTOPP_BYTESWAP_AVAILABLE) @@ -1804,7 +1798,7 @@ inline word32 ByteReverse(word32 value) return (word32)__lwbrx(&value,0); #elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL)) return _byteswap_ulong(value); -#elif CRYPTOPP_FAST_ROTATE(32) +#elif CRYPTOPP_FAST_ROTATE(32) && !defined(__xlC__) // 5 instructions with rotate instruction, 9 without return (rotrFixed(value, 8U) & 0xff00ff00) | (rotlFixed(value, 8U) & 0x00ff00ff); #else @@ -1819,10 +1813,7 @@ inline word32 ByteReverse(word32 value) //! \details ByteReverse calls bswap if available. Otherwise the function uses a combination of rotates on the word64 inline word64 ByteReverse(word64 value) { -#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE) && defined(__x86_64__) - __asm__ ("movbe %1, %0" : "=m" (value) : "q" (value)); - return value; -#elif defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(__x86_64__) +#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(__x86_64__) __asm__ ("bswap %0" : "=r" (value) : "0" (value)); return value; #elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)