[PATCH:libXext] Use __builtin_popcountl if available to replace Ones() in XSecurity.c

Alan Coopersmith alan.coopersmith at oracle.com
Fri Feb 26 19:11:50 UTC 2016


BTW, someone with more time than I have to test the X server could
try making a very similar change there in include/misc.h:

  extern _X_EXPORT int Ones(unsigned long /*mask */ );

+#ifdef HAVE___BUILTIN_POPCOUNTL
+# define Ones __builtin_popcountl
+#endif

but since Ones() there is part of the exported ABI, you want to leave
the original function in place and exported for use by modules, so
they don't depend on which compiler was used to build the core server.

As Keith & I noted on IRC, while this is probably much faster code for
this operation on many modern CPU's, it's also probably lost in the
noise to the actual user since Ones() isn't called that often in the
hot paths.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list