diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-23 11:29:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-23 11:37:28 +0000 |
commit | a7283ab143d4e95e8f5f22b58c61cb4e2f604749 (patch) | |
tree | 3ec5165ac7f1299f5c0dc3e41d7560a06e6267f5 /regressions/ck_cc/validate/ck_cc.c | |
parent | Adding debian version 0.6.0-2. (diff) | |
download | ck-a7283ab143d4e95e8f5f22b58c61cb4e2f604749.tar.xz ck-a7283ab143d4e95e8f5f22b58c61cb4e2f604749.zip |
Merging upstream version 0.7.1 (Closes: #991419).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'regressions/ck_cc/validate/ck_cc.c')
-rw-r--r-- | regressions/ck_cc/validate/ck_cc.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/regressions/ck_cc/validate/ck_cc.c b/regressions/ck_cc/validate/ck_cc.c new file mode 100644 index 0000000..a22030f --- /dev/null +++ b/regressions/ck_cc/validate/ck_cc.c @@ -0,0 +1,37 @@ +#include <ck_pr.h> +#include <limits.h> +#include <stdio.h> + +#include "../../common.h" + +int +main(void) +{ + unsigned int x; + + ck_pr_store_uint(&x, 0x10110); + + if (ck_cc_ffs(0) != 0) + ck_error("ffs(0) = %d\n", ck_cc_ffs(0)); + if (ck_cc_ffs(4) != 3) + ck_error("ffs(4) = %d\n", ck_cc_ffs(4)); + if (ck_cc_ffs(UINT_MAX) != 1) + ck_error("ffs(UINT_MAX) = %d\n", ck_cc_ffs(UINT_MAX)); + if (ck_cc_ffs(x) != 5) + ck_error("ffs(%u) = %d\n", x, ck_cc_ffs(x)); + + if (ck_cc_ffs(x) != ck_cc_ffsl(x) || + ck_cc_ffsl(x) != ck_cc_ffsll(x) || + ck_cc_ffs(x) != ck_cc_ffsll(x)) { + ck_error(" ffs = %d, ffsl = %d, ffsll = %d\n", + ck_cc_ffs(x), ck_cc_ffsl(x), ck_cc_ffsll(x)); + } + + if (ck_cc_ctz(x) != 4) + ck_error("ctz = %d\n", ck_cc_ctz(x)); + + if (ck_cc_popcount(x) != 3) + ck_error("popcount = %d\n", ck_cc_popcount(x)); + + return 0; +} |