From a8700688cf09036283096bc57b382219d230419c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Wed, 30 Oct 2024 16:10:30 -0300 Subject: [PATCH] add GCC >=15 __builtin_stdc_rotate_left suppor to rotl GCC does not support the clang builtins but does have type generic, type-checking __builtin_stdc_rotate_left. The only advantage of this is that the builtin evaluates the arguments only once. --- xxhash.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xxhash.h b/xxhash.h index c3ed9985..c2344b8d 100644 --- a/xxhash.h +++ b/xxhash.h @@ -2746,6 +2746,9 @@ static int XXH_isLittleEndian(void) && XXH_HAS_BUILTIN(__builtin_rotateleft64) # define XXH_rotl32 __builtin_rotateleft32 # define XXH_rotl64 __builtin_rotateleft64 +#elif XXH_HAS_BUILTIN(__builtin_stdc_rotate_left) +# define XXH_rotl32 __builtin_stdc_rotate_left +# define XXH_rotl64 __builtin_stdc_rotate_left /* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ #elif defined(_MSC_VER) # define XXH_rotl32(x,r) _rotl(x,r)