VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/misc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Crypto/misc.h')
-rw-r--r--src/Crypto/misc.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Crypto/misc.h b/src/Crypto/misc.h
index 2b4e9089..75ecedcd 100644
--- a/src/Crypto/misc.h
+++ b/src/Crypto/misc.h
@@ -87,10 +87,12 @@
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#else
-#ifdef CRYPTOPP_FAST_ROTATE(32)
+#if CRYPTOPP_FAST_ROTATE(32)
#define bswap_32(x) (rotr32((x), 8U) & 0xff00ff00) | (rotl32((x), 8U) & 0x00ff00ff)
#else
+#define CRYPTOPP_BYTESWAP_AVAILABLE
#define bswap_32(x) (rotl32((((x) & 0xFF00FF00) >> 8) | (((x) & 0x00FF00FF) << 8), 16U))
+#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
#ifndef TC_NO_COMPILER_INT64
#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)