Re-export Ones()

It's used by the nvidia driver

Fixes: 1642adec3 ("dix: unexport Ones()")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2051>
(cherry picked from commit 061690c2e6)
This commit is contained in:
Alan Coopersmith 2025-08-02 17:21:00 -07:00
parent 59673c0503
commit f5e806f2d4
2 changed files with 13 additions and 2 deletions

View file

@ -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_ */

View file

@ -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);
}