diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-14 21:43:56 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-14 21:44:20 -0400 |
commit | 8fe90522fb74dd84ff791a7546fee70047672396 (patch) | |
tree | 431a098266bd3ea245a0f019678667a06cc094b0 /src/test/test-util.c | |
parent | 40b71e89bae4e51768db4dc50ec64c1e9c96eec4 (diff) |
timedated: use builtins for integer log and exp
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r-- | src/test/test-util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index 6297182e0b..a6247726b0 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -645,6 +645,17 @@ static void test_hexdump(void) { hexdump(stdout, data, sizeof(data)); } +static void test_log2i(void) { + assert_se(log2i(1) == 0); + assert_se(log2i(2) == 1); + assert_se(log2i(3) == 1); + assert_se(log2i(4) == 2); + assert_se(log2i(32) == 5); + assert_se(log2i(33) == 5); + assert_se(log2i(63) == 5); + assert_se(log2i(INT_MAX) == sizeof(int)*8-2); +} + int main(int argc, char *argv[]) { log_parse_environment(); log_open(); @@ -687,6 +698,7 @@ int main(int argc, char *argv[]) { test_in_set(); test_writing_tmpfile(); test_hexdump(); + test_log2i(); return 0; } |