summaryrefslogtreecommitdiff
path: root/modules/count-leading-zeros
Commit message (Collapse)AuthorAgeFilesLines
* count-leading-zeros: Assume that the compiler supports 'long long'.Bruno Haible2019-12-221-2/+0
| | | | | | | | | | * lib/count-leading-zeros.h (count_leading_zeros_ll): Define unconditionally. * m4/count-leading-zeros.m4: Remove file. * modules/count-leading-zeros (Files): Remove it. (configure.ac): Don't invoke gl_COUNT_LEADING_ZEROS. * tests/test-count-leading-zeros.c (main): Test count_leading_zeros_ll unconditionally.
* count-leading-zeros: better 'inline'Paul Eggert2012-11-291-0/+3
| | | | | | | | | | | | * lib/count-leading-zeros.c: New file. * lib/count-leading-zeros.h (COUNT_LEADING_ZEROS_INLINE): New macro. Replace all uses of 'static inline' with it. Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END. * m4/count-leading-zeros.m4 (gl_COUNT_LEADING_ZEROS): Do not require AC_C_INLINE. * modules/count-leading-zeros (Files, lib_SOURCES): Add lib/count-leading-zeros.c. (Depends-on): Add extern-inline.
* count-leading-zeros: new moduleEric Blake2012-08-101-0/+23
I needed gcc's clz to determine the most significant bit of a number (useful for things like truncating to a power of 2), and was surprised it is not a standardized function (the opposite direction of finding the least significant bit is given by ffs). This borrows heavily from the design of the count-one-bits module. * modules/count-leading-zeros: New module. * m4/count-leading-zeros.m4: New file. * lib/count-leading-zeros.h: Likewise. * modules/count-leading-zeros-tests: New test. * tests/test-count-leading-zeros.c: New file. * MODULES.html.sh (Integer arithmetic functions): Document it. Signed-off-by: Eric Blake <eblake@redhat.com>