diff options
Diffstat (limited to 'src/Crypto')
-rw-r--r-- | src/Crypto/misc.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Crypto/misc.h b/src/Crypto/misc.h index 78044491..30346afc 100644 --- a/src/Crypto/misc.h +++ b/src/Crypto/misc.h @@ -33,8 +33,8 @@ #define CRYPTOPP_FAST_ROTATE(x) 0 #endif -#if defined( _MSC_VER ) && ( _MSC_VER > 800 )
-#pragma intrinsic(memcpy,memset)
+#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) +#pragma intrinsic(memcpy,memset) #endif #if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) @@ -59,8 +59,15 @@ #define CRYPTOPP_BYTESWAP_AVAILABLE #include <byteswap.h> #elif defined(_MSC_VER) && _MSC_VER >= 1300 +#define CRYPTOPP_BYTESWAP_AVAILABLE #define bswap_32(x) _byteswap_ulong(x) #define bswap_64(x) _byteswap_uint64(x) +#elif defined(__APPLE__) +#include <libkern/OSByteOrder.h> +#define CRYPTOPP_BYTESWAP_AVAILABLE +#define bswap_16 OSSwapInt16 +#define bswap_32 OSSwapInt32 +#define bswap_64 OSSwapInt64 #else #ifdef CRYPTOPP_FAST_ROTATE(32) #define bswap_32(x) (rotr32((x), 8U) & 0xff00ff00) | (rotl32((x), 8U) & 0x00ff00ff) @@ -68,7 +75,7 @@ #define bswap_32(x) (rotl32((((x) & 0xFF00FF00) >> 8) | (((x) & 0x00FF00FF) << 8), 16U)) #endif #ifndef TC_NO_COMPILER_INT64 -#define bswap_64(x) rotl64(((((((value & LL(0xFF00FF00FF00FF00)) >> 8) | ((value & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0xFFFF0000FFFF0000)) >> 16) | (((((value & LL(0xFF00FF00FF00FF00)) >> 8) | ((value & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0x0000FFFF0000FFFF)) << 16)), 32U) +#define bswap_64(x) rotl64(((((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0xFFFF0000FFFF0000)) >> 16) | (((((x & LL(0xFF00FF00FF00FF00)) >> 8) | ((x & LL(0x00FF00FF00FF00FF)) << 8)) & LL(0x0000FFFF0000FFFF)) << 16)), 32U) #endif #endif |