1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

help MSVC optimize ROL/ROR functions (#1392)

This commit is contained in:
SeungHwan Hur 2024-08-01 20:55:04 +09:00 committed by Frank Denis
parent 48e78c8066
commit 28ac48d112

View File

@ -30,6 +30,15 @@ typedef unsigned uint128_t __attribute__((mode(TI)));
# endif
#endif
# if defined(_MSC_VER)
#define ROTL32(X, B) _rotl((X), (B))
#define ROTL64(X, B) _rotl64((X), (B))
#define ROTR32(X, B) _rotr((X), (B))
#define ROTR64(X, B) _rotr64((X), (B))
#else
#define ROTL32(X, B) rotl32((X), (B))
static inline uint32_t
rotl32(const uint32_t x, const int b)
@ -58,6 +67,8 @@ rotr64(const uint64_t x, const int b)
return (x >> b) | (x << (64 - b));
}
#endif
#define LOAD64_LE(SRC) load64_le(SRC)
static inline uint64_t
load64_le(const uint8_t src[8])