Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Use __builtin_popcountl if available to replace Ones() in XSecurity.c | Alan Coopersmith | 2016-03-03 | 1 | -0/+168 |
If the compiler knows of a better algorithm for counting the number of bits set in a word for the target CPU, let it use that, instead of the classic algorithm optimized for PDP-6. Tested for the range of values used in XSecurity.c and verified results are the same from both: for (unsigned long i = 0; i <= XSecurityAllAuthorizationAttributes; i++) { printf("ones: %d\tpopcnt: %d\n", Ones(i), __builtin_popcountl(i)); } Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> |