summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2010-10-24 05:59:10 +0000
committerMatt Turner <mattst88@gmail.com>2010-10-24 05:59:10 +0000
commit40cb5f6104f1531947b12787c1b29672588ef1f9 (patch)
treea4526c6bfbe6c51f4c936da4c400e2c8b6d25399 /testsuite
parenta55e41c31de52d216d0e43e1537ab3a6e7e44f32 (diff)
Move variable declarations into loopHEADmaster
git-svn-id: svn://mattst88.com/svn/alpha_mmintrin/trunk@8 f7d56953-e76f-4e43-a77e-20d50f6c004e
Diffstat (limited to 'testsuite')
-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);