• Eric Blake's avatar
    count-leading-zeros: new module · 0da76a94
    Eric Blake authored
    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: 's avatarEric Blake <eblake@redhat.com>
count-leading-zeros-tests 174 Bytes