bpo-29882: Add _Py_popcount32() function (GH-20518)

* Rename pycore_byteswap.h to pycore_bitutils.h.
* Move popcount_digit() to pycore_bitutils.h as _Py_popcount32().
* _Py_popcount32() uses GCC and clang builtin function if available.
* Add unit tests to _Py_popcount32().
This commit is contained in:
Victor Stinner 2020-06-08 16:30:33 +02:00 committed by GitHub
parent 301f0d4ff9
commit c6b292cdee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 108 additions and 39 deletions

View file

@ -4,7 +4,7 @@
# error "codecs.h is specific to Unicode"
#endif
#include "pycore_byteswap.h" // _Py_bswap32()
#include "pycore_bitutils.h" // _Py_bswap32()
/* Mask to quickly check whether a C 'long' contains a
non-ASCII, UTF8-encoded char. */