mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-14 14:01:48 +03:00
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>
12 lines
174 B
Plaintext
12 lines
174 B
Plaintext
Files:
|
|
tests/test-count-leading-zeros.c
|
|
tests/macros.h
|
|
|
|
Depends-on:
|
|
|
|
configure.ac:
|
|
|
|
Makefile.am:
|
|
TESTS += test-count-leading-zeros
|
|
check_PROGRAMS += test-count-leading-zeros
|