Fixed compilation errors and warnings in unit test

Fixed an error due to a narrowing conversion in an initializer list in core_func_integer_bit_count.cpp, and various
printf format string issues that caused compiler warnings for me. std::clock_t isn't guaranteed to be any specific
integer type, nor is it even guaranteed to be integral (it can be floating point). So, the safest bet is to cast it to
double and use the %f specifier in printf format strings.
This commit is contained in:
Collin Baker 2015-07-22 00:01:28 -04:00
parent 8e742a4d07
commit ff1581d67a
3 changed files with 43 additions and 43 deletions

View File

@ -210,7 +210,7 @@ int main()
# ifdef NDEBUG # ifdef NDEBUG
int i, n; int i, n;
static int test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3, static unsigned test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3,
8,1, 9,2, 10,2, 11,3, 12,2, 13,3, 14,3, 15,4, 16,1, 17,2, 8,1, 9,2, 10,2, 11,3, 12,2, 13,3, 14,3, 15,4, 16,1, 17,2,
0x3F,6, 0x40,1, 0x41,2, 0x7f,7, 0x80,1, 0x81,2, 0xfe,7, 0xff,8, 0x3F,6, 0x40,1, 0x41,2, 0x7f,7, 0x80,1, 0x81,2, 0xfe,7, 0xff,8,
0x4000,1, 0x4001,2, 0x7000,3, 0x7fff,15, 0x4000,1, 0x4001,2, 0x7000,3, 0x7fff,15,
@ -230,7 +230,7 @@ int main()
if (pop0(test[i]) != test[i+1]) error(test[i], pop0(test[i]));} if (pop0(test[i]) != test[i+1]) error(test[i], pop0(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop0: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop0: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -238,7 +238,7 @@ int main()
if (pop1(test[i]) != test[i+1]) error(test[i], pop1(test[i]));} if (pop1(test[i]) != test[i+1]) error(test[i], pop1(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop1: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop1: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -246,7 +246,7 @@ int main()
if (pop2(test[i]) != test[i+1]) error(test[i], pop2(test[i]));} if (pop2(test[i]) != test[i+1]) error(test[i], pop2(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop2: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop2: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -254,7 +254,7 @@ int main()
if (pop3(test[i]) != test[i+1]) error(test[i], pop3(test[i]));} if (pop3(test[i]) != test[i+1]) error(test[i], pop3(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop3: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop3: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -262,7 +262,7 @@ int main()
if (pop4(test[i]) != test[i+1]) error(test[i], pop4(test[i]));} if (pop4(test[i]) != test[i+1]) error(test[i], pop4(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop4: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop4: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -270,7 +270,7 @@ int main()
if (pop5(test[i]) != test[i+1]) error(test[i], pop5(test[i]));} if (pop5(test[i]) != test[i+1]) error(test[i], pop5(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop5: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop5: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -278,7 +278,7 @@ int main()
if (pop5a(test[i]) != test[i+1]) error(test[i], pop5a(test[i]));} if (pop5a(test[i]) != test[i+1]) error(test[i], pop5a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop5a: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop5a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -286,7 +286,7 @@ int main()
if (pop6(test[i]) != test[i+1]) error(test[i], pop6(test[i]));} if (pop6(test[i]) != test[i+1]) error(test[i], pop6(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop6: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop6: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -295,7 +295,7 @@ int main()
if (pop7(test[i]) != test[i+1]) error(test[i], pop7(test[i]));} if (pop7(test[i]) != test[i+1]) error(test[i], pop7(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop7: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop7: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -304,7 +304,7 @@ int main()
if (pop8(test[i]) != test[i+1]) error(test[i], pop8(test[i]));} if (pop8(test[i]) != test[i+1]) error(test[i], pop8(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop8: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop8: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -313,10 +313,10 @@ int main()
if (pop9(test[i]) != test[i+1]) error(test[i], pop9(test[i]));} if (pop9(test[i]) != test[i+1]) error(test[i], pop9(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("pop9: %d clocks\n", TimestampEnd - TimestampBeg); printf("pop9: %f clocks\n", (double) TimestampEnd - TimestampBeg);
if (errors == 0) if (errors == 0)
printf("Passed all %d cases.\n", sizeof(test)/8); printf("Passed all %zu cases.\n", sizeof(test)/8);
# endif//NDEBUG # endif//NDEBUG
} }

View File

@ -317,7 +317,7 @@ int main()
if (ntz1(test[i]) != test[i+1]) error(test[i], ntz1(test[i]));} if (ntz1(test[i]) != test[i+1]) error(test[i], ntz1(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz1: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz1: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -325,7 +325,7 @@ int main()
if (ntz2(test[i]) != test[i+1]) error(test[i], ntz2(test[i]));} if (ntz2(test[i]) != test[i+1]) error(test[i], ntz2(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz2: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz2: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -333,7 +333,7 @@ int main()
if (ntz3(test[i]) != test[i+1]) error(test[i], ntz3(test[i]));} if (ntz3(test[i]) != test[i+1]) error(test[i], ntz3(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz3: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz3: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -341,7 +341,7 @@ int main()
if (ntz4(test[i]) != test[i+1]) error(test[i], ntz4(test[i]));} if (ntz4(test[i]) != test[i+1]) error(test[i], ntz4(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz4: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz4: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -349,7 +349,7 @@ int main()
if (ntz4a(test[i]) != test[i+1]) error(test[i], ntz4a(test[i]));} if (ntz4a(test[i]) != test[i+1]) error(test[i], ntz4a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz4a: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz4a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -358,7 +358,7 @@ int main()
if (ntz5(test[i]) != m) error(test[i], ntz5(test[i]));} if (ntz5(test[i]) != m) error(test[i], ntz5(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz5: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz5: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -366,7 +366,7 @@ int main()
if (ntz6(test[i]) != test[i+1]) error(test[i], ntz6(test[i]));} if (ntz6(test[i]) != test[i+1]) error(test[i], ntz6(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz6: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz6: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -374,7 +374,7 @@ int main()
if (ntz6a(test[i]) != test[i+1]) error(test[i], ntz6a(test[i]));} if (ntz6a(test[i]) != test[i+1]) error(test[i], ntz6a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz6a: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz6a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -382,7 +382,7 @@ int main()
if (ntz7(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));} if (ntz7(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz7: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz7: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -390,7 +390,7 @@ int main()
if (ntz7_christophe(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));} if (ntz7_christophe(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz7_christophe: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz7_christophe: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -398,7 +398,7 @@ int main()
if (ntz8(test[i]) != test[i+1]) error(test[i], ntz8(test[i]));} if (ntz8(test[i]) != test[i+1]) error(test[i], ntz8(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz8: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz8: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -406,7 +406,7 @@ int main()
if (ntz8a(test[i]) != test[i+1]) error(test[i], ntz8a(test[i]));} if (ntz8a(test[i]) != test[i+1]) error(test[i], ntz8a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz8a: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz8a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -414,7 +414,7 @@ int main()
if (ntz9(test[i]) != test[i+1]) error(test[i], ntz9(test[i]));} if (ntz9(test[i]) != test[i+1]) error(test[i], ntz9(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz9: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz9: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -422,10 +422,10 @@ int main()
if (ntz10(test[i]) != test[i+1]) error(test[i], ntz10(test[i]));} if (ntz10(test[i]) != test[i+1]) error(test[i], ntz10(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("ntz10: %d clocks\n", TimestampEnd - TimestampBeg); printf("ntz10: %f clocks\n", (double) TimestampEnd - TimestampBeg);
if (errors == 0) if (errors == 0)
printf("Passed all %d cases.\n", sizeof(test)/8); printf("Passed all %zu cases.\n", sizeof(test)/8);
# endif//NDEBUG # endif//NDEBUG
} }

View File

@ -355,7 +355,7 @@ int main()
if (nlz1(test[i]) != test[i+1]) error(test[i], nlz1(test[i]));} if (nlz1(test[i]) != test[i+1]) error(test[i], nlz1(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz1: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz1: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -363,7 +363,7 @@ int main()
if (nlz1a(test[i]) != test[i+1]) error(test[i], nlz1a(test[i]));} if (nlz1a(test[i]) != test[i+1]) error(test[i], nlz1a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz1a: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz1a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -371,7 +371,7 @@ int main()
if (nlz2(test[i]) != test[i+1]) error(test[i], nlz2(test[i]));} if (nlz2(test[i]) != test[i+1]) error(test[i], nlz2(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz2: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz2: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -379,7 +379,7 @@ int main()
if (nlz2a(test[i]) != test[i+1]) error(test[i], nlz2a(test[i]));} if (nlz2a(test[i]) != test[i+1]) error(test[i], nlz2a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz2a: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz2a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -387,7 +387,7 @@ int main()
if (nlz3(test[i]) != test[i+1]) error(test[i], nlz3(test[i]));} if (nlz3(test[i]) != test[i+1]) error(test[i], nlz3(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz3: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz3: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -395,7 +395,7 @@ int main()
if (nlz4(test[i]) != test[i+1]) error(test[i], nlz4(test[i]));} if (nlz4(test[i]) != test[i+1]) error(test[i], nlz4(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz4: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz4: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -403,7 +403,7 @@ int main()
if (nlz5(test[i]) != test[i+1]) error(test[i], nlz5(test[i]));} if (nlz5(test[i]) != test[i+1]) error(test[i], nlz5(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz5: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz5: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -411,7 +411,7 @@ int main()
if (nlz6(test[i]) != test[i+1]) error(test[i], nlz6(test[i]));} if (nlz6(test[i]) != test[i+1]) error(test[i], nlz6(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz6: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz6: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -419,7 +419,7 @@ int main()
if (nlz7(test[i]) != test[i+1]) error(test[i], nlz7(test[i]));} if (nlz7(test[i]) != test[i+1]) error(test[i], nlz7(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz7: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz7: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -427,7 +427,7 @@ int main()
if (nlz8(test[i]) != test[i+1]) error(test[i], nlz8(test[i]));} if (nlz8(test[i]) != test[i+1]) error(test[i], nlz8(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz8: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz8: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -435,7 +435,7 @@ int main()
if (nlz9(test[i]) != test[i+1]) error(test[i], nlz9(test[i]));} if (nlz9(test[i]) != test[i+1]) error(test[i], nlz9(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz9: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz9: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -443,7 +443,7 @@ int main()
if (nlz10(test[i]) != test[i+1]) error(test[i], nlz10(test[i]));} if (nlz10(test[i]) != test[i+1]) error(test[i], nlz10(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz10: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz10: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -451,7 +451,7 @@ int main()
if (nlz10a(test[i]) != test[i+1]) error(test[i], nlz10a(test[i]));} if (nlz10a(test[i]) != test[i+1]) error(test[i], nlz10a(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz10a: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz10a: %f clocks\n", (double) TimestampEnd - TimestampBeg);
TimestampBeg = std::clock(); TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k) for (std::size_t k = 0; k < Count; ++k)
@ -459,10 +459,10 @@ int main()
if (nlz10b(test[i]) != test[i+1]) error(test[i], nlz10b(test[i]));} if (nlz10b(test[i]) != test[i+1]) error(test[i], nlz10b(test[i]));}
TimestampEnd = std::clock(); TimestampEnd = std::clock();
printf("nlz10b: %d clocks\n", TimestampEnd - TimestampBeg); printf("nlz10b: %f clocks\n", (double) TimestampEnd - TimestampBeg);
if (errors == 0) if (errors == 0)
printf("Passed all %d cases.\n", sizeof(test)/8); printf("Passed all %zu cases.\n", sizeof(test)/8);
# endif//NDEBUG # endif//NDEBUG
} }