parent
d2ad6751d5
commit
3525fd48da
17
misc.h
17
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
|
//! \details ByteReverse calls bswap if available. Otherwise the function performs a 8-bit rotate on the word16
|
||||||
inline word16 ByteReverse(word16 value)
|
inline word16 ByteReverse(word16 value)
|
||||||
{
|
{
|
||||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE)
|
#if defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||||
__asm__ ("movbe %1, %0" : "=m" (value) : "q" (value));
|
|
||||||
return value;
|
|
||||||
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
|
||||||
return bswap_16(value);
|
return bswap_16(value);
|
||||||
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
||||||
return _byteswap_ushort(value);
|
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
|
//! \details ByteReverse calls bswap if available. Otherwise the function uses a combination of rotates on the word32
|
||||||
inline word32 ByteReverse(word32 value)
|
inline word32 ByteReverse(word32 value)
|
||||||
{
|
{
|
||||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE)
|
#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE)
|
||||||
__asm__ ("movbe %1, %0" : "=m" (value) : "q" (value));
|
|
||||||
return value;
|
|
||||||
#elif defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE)
|
|
||||||
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
||||||
return value;
|
return value;
|
||||||
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||||
|
|
@ -1804,7 +1798,7 @@ inline word32 ByteReverse(word32 value)
|
||||||
return (word32)__lwbrx(&value,0);
|
return (word32)__lwbrx(&value,0);
|
||||||
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
||||||
return _byteswap_ulong(value);
|
return _byteswap_ulong(value);
|
||||||
#elif CRYPTOPP_FAST_ROTATE(32)
|
#elif CRYPTOPP_FAST_ROTATE(32) && !defined(__xlC__)
|
||||||
// 5 instructions with rotate instruction, 9 without
|
// 5 instructions with rotate instruction, 9 without
|
||||||
return (rotrFixed(value, 8U) & 0xff00ff00) | (rotlFixed(value, 8U) & 0x00ff00ff);
|
return (rotrFixed(value, 8U) & 0xff00ff00) | (rotlFixed(value, 8U) & 0x00ff00ff);
|
||||||
#else
|
#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
|
//! \details ByteReverse calls bswap if available. Otherwise the function uses a combination of rotates on the word64
|
||||||
inline word64 ByteReverse(word64 value)
|
inline word64 ByteReverse(word64 value)
|
||||||
{
|
{
|
||||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MOVBE_AVAILABLE) && defined(__x86_64__)
|
#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_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__)
|
|
||||||
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
||||||
return value;
|
return value;
|
||||||
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
#elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue