internal: add macro to round value to the next closest power of 2

There are two special cases, if the input number is 0 or the number is
larger then 2^31 (for 32bit unsigned int). For the special cases the
return value is 0 because they cannot be rounded.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina
2014-11-18 17:13:38 +01:00
parent 3a04f73997
commit ff28ebf136
3 changed files with 47 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ clock-time
close
connect
configmake
count-leading-zeros
count-one-bits
crypto/md5
crypto/sha256