From f5e806f2d4ea889a13d5ef352c178f42beb15d01 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: (cherry picked from commit 061690c2e649ce41ae277dd7555ad90855376e31) --- 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 b10e88132..ad90edcfa 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -251,7 +251,7 @@ Bool WaitForSomething(Bool clients_are_ready); void CloseDownConnection(ClientPtr client); #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. @@ -259,7 +259,7 @@ void CloseDownConnection(ClientPtr client); * https://dspace.mit.edu/handle/1721.1/6086 */ static inline int -Ones(unsigned long mask) +Xpopcountl(unsigned long mask) { unsigned long y; @@ -268,5 +268,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 c024ce24b..79e2f13f6 100644 --- a/os/utils.c +++ b/os/utils.c @@ -2020,3 +2020,13 @@ os_move_fd(int fd) return newfd; } #endif + +/* 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); +}