summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/ctlz.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/testsuite/ctlz.c b/testsuite/ctlz.c
index eb7c96b..81023f9 100644
--- a/testsuite/ctlz.c
+++ b/testsuite/ctlz.c
@@ -11,12 +11,11 @@
int main(int argc, char ** argv) {
uint64_t a[ARRAY_ELEMENTS], b[ARRAY_ELEMENTS], c[ARRAY_ELEMENTS];
- uint64_t l1, l2;
struct timespec cix_start, cix_end;
double cix_t0, cix_t1, cix_total;
struct timespec noncix_start, noncix_end;
double noncix_t0, noncix_t1, noncix_total;
- int i, j, count = 0;
+ int i, j;
srand(time(NULL));
@@ -27,9 +26,8 @@ int main(int argc, char ** argv) {
clock_gettime(CLOCK_MONOTONIC, &cix_start);
for (j = 0; j < ITERATIONS; j++) {
for (i = 0; i < ARRAY_ELEMENTS; i++) {
- l1 = a[i];
-
- l2 = 1 << (64 - __ctlz(l1));
+ uint64_t l1 = a[i];
+ uint64_t l2 = 1 << (64 - __ctlz(l1));
b[i] = l2;
}
@@ -39,14 +37,15 @@ int main(int argc, char ** argv) {
clock_gettime(CLOCK_MONOTONIC, &noncix_start);
for (j = 0; j < ITERATIONS; j++) {
for (i = 0; i < ARRAY_ELEMENTS; i++) {
- l1 = a[i];
+ uint64_t l1 = a[i];
+ uint64_t l2;
+ int count = 0;
while (l1 != 0) {
l1 >>= 1;
count += 1;
}
l2 = 1 << count;
c[i] = l2;
- count = 0;
}
}
clock_gettime(CLOCK_MONOTONIC, &noncix_end);