1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-09-15 11:41:20 +03:00

2 Commits

Author SHA1 Message Date
Bruno Haible
57bac80c66 count-leading-zeros tests: Rely on limits-h module.
* tests/test-count-leading-zeros.c (ULLONG_MAX): Remove fallback
definition.
* modules/count-leading-zeros-tests (Depends-on): Add 'limits-h'.
2018-09-06 14:49:14 +02:00
Eric Blake
0da76a94c8 count-leading-zeros: new module
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>
2012-08-10 17:10:15 -06:00