From 061690c2e649ce41ae277dd7555ad90855376e31 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 2 Aug 2025 17:21:00 -0700 Subject: [PATCH] Re-export Ones() It's used by the nvidia driver Fixes: 1642adec3 ("dix: unexport Ones()") Signed-off-by: Alan Coopersmith Part-of: --- os/osdep.h | 5 +++-- os/utils.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/os/osdep.h b/os/osdep.h index c93481969..9ed8a3623 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -205,7 +205,7 @@ extern Bool NoListenAll; extern Bool AllowByteSwappedClients; #if __has_builtin(__builtin_popcountl) -# define Ones __builtin_popcountl +# define Xpopcountl __builtin_popcountl #else /* * Count the number of bits set to 1 in a 32-bit word. @@ -213,7 +213,7 @@ extern Bool AllowByteSwappedClients; * https://dspace.mit.edu/handle/1721.1/6086 */ static inline int -Ones(unsigned long mask) +Xpopcountl(unsigned long mask) { unsigned long y; @@ -222,5 +222,6 @@ Ones(unsigned long mask) return (((y + (y >> 3)) & 030707070707) % 077); } #endif +#define Ones Xpopcountl #endif /* _OSDEP_H_ */ diff --git a/os/utils.c b/os/utils.c index ba5280694..23f15bf4a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1563,3 +1563,13 @@ AbortServer(void) OsAbort(); exit(1); } + +/* Exported version for binary compatibility with modules which call it */ +#undef Ones +_X_EXPORT int Ones(unsigned long); + +int +Ones (unsigned long mask) +{ + return Xpopcountl(mask); +}