Fixed the check for __builtin_popcountl for old compilers.

Old compilers used on some platforms (e.g. DragonFlyBSD) do not support __has_builtin, so now we fall back to #if define if __has_builtin is not found.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
This commit is contained in:
b-aaz
2025-09-07 22:01:48 +00:00
committed by Enrico Weigelt
parent af8b69b710
commit 99bc9e7800

View File

@@ -20,8 +20,12 @@ int
Ones(unsigned long mask)
{ /* HACKMEM 169 */
/* can't add a message here because this should be fast */
#if defined __has_builtin
#if __has_builtin(__builtin_popcountl)
return __builtin_popcountl (mask);
#endif
#elif defined __builtin_popcountl
return __builtin_popcountl (mask);
#else
unsigned long y;