From 99bc9e7800948b14567a5eb87d9e001af21b48cb Mon Sep 17 00:00:00 2001 From: b-aaz <85005689+b-aaz@users.noreply.github.com> Date: Sun, 7 Sep 2025 22:01:48 +0000 Subject: [PATCH] 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 --- hw/xfree86/compat/ones.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xfree86/compat/ones.c b/hw/xfree86/compat/ones.c index 37f724a2f4..eee0bcf27c 100644 --- a/hw/xfree86/compat/ones.c +++ b/hw/xfree86/compat/ones.c @@ -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;