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