1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 01:55:02 -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 GitHub
parent 563ec3d3e5
commit e1861bb935
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,6 +32,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)
@ -60,6 +69,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])