Fixed missing std:: namespace #898

This commit is contained in:
Christophe Riccio
2019-09-07 13:41:08 +02:00
parent 823125a6cd
commit 61b2a73e21
17 changed files with 238 additions and 228 deletions

View File

@@ -1,13 +1,13 @@
// This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) {printf("rotatel, n out of range.\n"); exit(1);}
if (static_cast<unsigned>(n) > 63) { std::printf("rotatel, n out of range.\n"); std::exit(1);}
return (x << n) | (x >> (32 - n));
}
@@ -171,7 +171,7 @@ int errors;
void error(int x, int y)
{
errors = errors + 1;
printf("Error for x = %08x, got %08x\n", x, y);
std::printf("Error for x = %08x, got %08x\n", x, y);
}
int main()
@@ -199,7 +199,7 @@ int main()
if (pop0(test[i]) != test[i+1]) error(test[i], pop0(test[i]));}
TimestampEnd = std::clock();
printf("pop0: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop0: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -207,7 +207,7 @@ int main()
if (pop1(test[i]) != test[i+1]) error(test[i], pop1(test[i]));}
TimestampEnd = std::clock();
printf("pop1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -215,7 +215,7 @@ int main()
if (pop2(test[i]) != test[i+1]) error(test[i], pop2(test[i]));}
TimestampEnd = std::clock();
printf("pop2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -223,7 +223,7 @@ int main()
if (pop3(test[i]) != test[i+1]) error(test[i], pop3(test[i]));}
TimestampEnd = std::clock();
printf("pop3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -231,7 +231,7 @@ int main()
if (pop4(test[i]) != test[i+1]) error(test[i], pop4(test[i]));}
TimestampEnd = std::clock();
printf("pop4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -239,7 +239,7 @@ int main()
if (pop5(test[i]) != test[i+1]) error(test[i], pop5(test[i]));}
TimestampEnd = std::clock();
printf("pop5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -247,7 +247,7 @@ int main()
if (pop5a(test[i]) != test[i+1]) error(test[i], pop5a(test[i]));}
TimestampEnd = std::clock();
printf("pop5a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop5a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -255,7 +255,7 @@ int main()
if (pop6(test[i]) != test[i+1]) error(test[i], pop6(test[i]));}
TimestampEnd = std::clock();
printf("pop6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -264,7 +264,7 @@ int main()
if (pop7(test[i]) != test[i+1]) error(test[i], pop7(test[i]));}
TimestampEnd = std::clock();
printf("pop7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -273,7 +273,7 @@ int main()
if (pop8(test[i]) != test[i+1]) error(test[i], pop8(test[i]));}
TimestampEnd = std::clock();
printf("pop8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -282,10 +282,10 @@ int main()
if (pop9(test[i]) != test[i+1]) error(test[i], pop9(test[i]));}
TimestampEnd = std::clock();
printf("pop9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("pop9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
if (errors == 0)
printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
std::printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
# endif//NDEBUG
}

View File

@@ -3,72 +3,79 @@
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x) {
int pop(unsigned x);
int nlz(unsigned x)
{
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >>16);
return pop(~x);
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >>16);
return pop(~x);
}
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0F0F0F0F;
x = x + (x << 8);
x = x + (x << 16);
return x >> 24;
int pop(unsigned x)
{
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0F0F0F0F;
x = x + (x << 8);
x = x + (x << 16);
return x >> 24;
}
int ntz1(unsigned x) {
return 32 - nlz(~x & (x-1));
int ntz1(unsigned x)
{
return 32 - nlz(~x & (x-1));
}
int ntz2(unsigned x) {
return pop(~x & (x - 1));
int ntz2(unsigned x)
{
return pop(~x & (x - 1));
}
int ntz3(unsigned x) {
int n;
int ntz3(unsigned x)
{
int n;
if (x == 0) return(32);
n = 1;
if ((x & 0x0000FFFF) == 0) {n = n +16; x = x >>16;}
if ((x & 0x000000FF) == 0) {n = n + 8; x = x >> 8;}
if ((x & 0x0000000F) == 0) {n = n + 4; x = x >> 4;}
if ((x & 0x00000003) == 0) {n = n + 2; x = x >> 2;}
return n - (x & 1);
if (x == 0) return(32);
n = 1;
if ((x & 0x0000FFFF) == 0) {n = n +16; x = x >>16;}
if ((x & 0x000000FF) == 0) {n = n + 8; x = x >> 8;}
if ((x & 0x0000000F) == 0) {n = n + 4; x = x >> 4;}
if ((x & 0x00000003) == 0) {n = n + 2; x = x >> 2;}
return n - (x & 1);
}
int ntz4(unsigned x) {
unsigned y;
int n;
int ntz4(unsigned x)
{
unsigned y;
int n;
if (x == 0) return 32;
n = 31;
y = x <<16; if (y != 0) {n = n -16; x = y;}
y = x << 8; if (y != 0) {n = n - 8; x = y;}
y = x << 4; if (y != 0) {n = n - 4; x = y;}
y = x << 2; if (y != 0) {n = n - 2; x = y;}
y = x << 1; if (y != 0) {n = n - 1;}
return n;
if (x == 0) return 32;
n = 31;
y = x <<16; if (y != 0) {n = n -16; x = y;}
y = x << 8; if (y != 0) {n = n - 8; x = y;}
y = x << 4; if (y != 0) {n = n - 4; x = y;}
y = x << 2; if (y != 0) {n = n - 2; x = y;}
y = x << 1; if (y != 0) {n = n - 1;}
return n;
}
int ntz4a(unsigned x) {
unsigned y;
int n;
int ntz4a(unsigned x)
{
unsigned y;
int n;
if (x == 0) return 32;
n = 31;
y = x <<16; if (y != 0) {n = n -16; x = y;}
y = x << 8; if (y != 0) {n = n - 8; x = y;}
y = x << 4; if (y != 0) {n = n - 4; x = y;}
y = x << 2; if (y != 0) {n = n - 2; x = y;}
n = n - ((x << 1) >> 31);
return n;
if (x == 0) return 32;
n = 31;
y = x <<16; if (y != 0) {n = n -16; x = y;}
y = x << 8; if (y != 0) {n = n - 8; x = y;}
y = x << 4; if (y != 0) {n = n - 4; x = y;}
y = x << 2; if (y != 0) {n = n - 2; x = y;}
n = n - ((x << 1) >> 31);
return n;
}
int ntz5(char x)
@@ -90,16 +97,18 @@ int ntz5(char x)
else return 8;
}
int ntz6(unsigned x) {
int n;
int ntz6(unsigned x)
{
int n;
x = ~x & (x - 1);
n = 0; // n = 32;
while(x != 0) { // while (x != 0) {
n = n + 1; // n = n - 1;
x = x >> 1; // x = x + x;
} // }
return n; // return n;
x = ~x & (x - 1);
n = 0; // n = 32;
while(x != 0)
{ // while (x != 0) {
n = n + 1; // n = n - 1;
x = x >> 1; // x = x + x;
} // }
return n; // return n;
}
int ntz6a(unsigned x)
@@ -201,15 +210,16 @@ int ntz8a(unsigned x)
/* Reiser's algorithm. Three ops including a "remainder,"
plus an indexed load. */
int ntz9(unsigned x) {
int ntz9(unsigned x)
{
static char table[37] = {
32, 0, 1, 26, 2, 23, 27,
u, 3, 16, 24, 30, 28, 11, u, 13, 4,
7, 17, u, 25, 22, 31, 15, 29, 10, 12,
6, u, 21, 14, 9, 5, 20, 8, 19, 18};
static char table[37] = {32, 0, 1, 26, 2, 23, 27,
u, 3, 16, 24, 30, 28, 11, u, 13, 4,
7, 17, u, 25, 22, 31, 15, 29, 10, 12,
6, u, 21, 14, 9, 5, 20, 8, 19, 18};
x = (x & -x)%37;
return table[x];
x = (x & -x)%37;
return table[x];
}
/* Using a de Bruijn sequence. This is a table lookup with a 32-entry
@@ -257,7 +267,7 @@ int ntz11 (unsigned int n) {
int errors;
void error(int x, int y) {
errors = errors + 1;
printf("Error for x = %08x, got %d\n", x, y);
std::printf("Error for x = %08x, got %d\n", x, y);
}
int main()
@@ -287,7 +297,7 @@ int main()
if (ntz1(test[i]) != test[i+1]) error(test[i], ntz1(test[i]));}
TimestampEnd = std::clock();
printf("ntz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -295,7 +305,7 @@ int main()
if (ntz2(test[i]) != test[i+1]) error(test[i], ntz2(test[i]));}
TimestampEnd = std::clock();
printf("ntz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -303,7 +313,7 @@ int main()
if (ntz3(test[i]) != test[i+1]) error(test[i], ntz3(test[i]));}
TimestampEnd = std::clock();
printf("ntz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -311,7 +321,7 @@ int main()
if (ntz4(test[i]) != test[i+1]) error(test[i], ntz4(test[i]));}
TimestampEnd = std::clock();
printf("ntz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -319,7 +329,7 @@ int main()
if (ntz4a(test[i]) != test[i+1]) error(test[i], ntz4a(test[i]));}
TimestampEnd = std::clock();
printf("ntz4a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz4a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for(std::size_t k = 0; k < Count; ++k)
@@ -333,7 +343,7 @@ int main()
}
TimestampEnd = std::clock();
printf("ntz5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -341,7 +351,7 @@ int main()
if (ntz6(test[i]) != test[i+1]) error(test[i], ntz6(test[i]));}
TimestampEnd = std::clock();
printf("ntz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -349,7 +359,7 @@ int main()
if (ntz6a(test[i]) != test[i+1]) error(test[i], ntz6a(test[i]));}
TimestampEnd = std::clock();
printf("ntz6a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz6a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -357,7 +367,7 @@ int main()
if (ntz7(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock();
printf("ntz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -365,7 +375,7 @@ int main()
if (ntz7_christophe(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock();
printf("ntz7_christophe: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz7_christophe: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -373,7 +383,7 @@ int main()
if (ntz8(test[i]) != test[i+1]) error(test[i], ntz8(test[i]));}
TimestampEnd = std::clock();
printf("ntz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -381,7 +391,7 @@ int main()
if (ntz8a(test[i]) != test[i+1]) error(test[i], ntz8a(test[i]));}
TimestampEnd = std::clock();
printf("ntz8a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz8a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -389,7 +399,7 @@ int main()
if (ntz9(test[i]) != test[i+1]) error(test[i], ntz9(test[i]));}
TimestampEnd = std::clock();
printf("ntz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -397,10 +407,10 @@ int main()
if (ntz10(test[i]) != test[i+1]) error(test[i], ntz10(test[i]));}
TimestampEnd = std::clock();
printf("ntz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("ntz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
if (errors == 0)
printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
std::printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
# endif//NDEBUG
}

View File

@@ -298,7 +298,7 @@ int errors;
void error(int x, int y)
{
errors = errors + 1;
printf("Error for x = %08x, got %d\n", x, y);
std::printf("Error for x = %08x, got %d\n", x, y);
}
int main()
@@ -327,7 +327,7 @@ int main()
if (nlz1(test[i]) != test[i+1]) error(test[i], nlz1(test[i]));}
TimestampEnd = std::clock();
printf("nlz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -335,7 +335,7 @@ int main()
if (nlz1a(test[i]) != test[i+1]) error(test[i], nlz1a(test[i]));}
TimestampEnd = std::clock();
printf("nlz1a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz1a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -343,7 +343,7 @@ int main()
if (nlz2(test[i]) != test[i+1]) error(test[i], nlz2(test[i]));}
TimestampEnd = std::clock();
printf("nlz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -351,7 +351,7 @@ int main()
if (nlz2a(test[i]) != test[i+1]) error(test[i], nlz2a(test[i]));}
TimestampEnd = std::clock();
printf("nlz2a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz2a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -359,7 +359,7 @@ int main()
if (nlz3(test[i]) != test[i+1]) error(test[i], nlz3(test[i]));}
TimestampEnd = std::clock();
printf("nlz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -367,7 +367,7 @@ int main()
if (nlz4(test[i]) != test[i+1]) error(test[i], nlz4(test[i]));}
TimestampEnd = std::clock();
printf("nlz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -375,7 +375,7 @@ int main()
if (nlz5(test[i]) != test[i+1]) error(test[i], nlz5(test[i]));}
TimestampEnd = std::clock();
printf("nlz5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -383,7 +383,7 @@ int main()
if (nlz6(test[i]) != test[i+1]) error(test[i], nlz6(test[i]));}
TimestampEnd = std::clock();
printf("nlz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -391,7 +391,7 @@ int main()
if (nlz7(test[i]) != test[i+1]) error(test[i], nlz7(test[i]));}
TimestampEnd = std::clock();
printf("nlz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -399,7 +399,7 @@ int main()
if (nlz8(test[i]) != test[i+1]) error(test[i], nlz8(test[i]));}
TimestampEnd = std::clock();
printf("nlz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -407,7 +407,7 @@ int main()
if (nlz9(test[i]) != test[i+1]) error(test[i], nlz9(test[i]));}
TimestampEnd = std::clock();
printf("nlz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -415,7 +415,7 @@ int main()
if (nlz10(test[i]) != test[i+1]) error(test[i], nlz10(test[i]));}
TimestampEnd = std::clock();
printf("nlz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -423,7 +423,7 @@ int main()
if (nlz10a(test[i]) != test[i+1]) error(test[i], nlz10a(test[i]));}
TimestampEnd = std::clock();
printf("nlz10a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz10a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
@@ -431,10 +431,10 @@ int main()
if (nlz10b(test[i]) != test[i+1]) error(test[i], nlz10b(test[i]));}
TimestampEnd = std::clock();
printf("nlz10b: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
std::printf("nlz10b: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
if (errors == 0)
printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
std::printf("Passed all %d cases.\n", static_cast<int>(sizeof(test)/8));
# endif//NDEBUG
}

View File

@@ -297,7 +297,7 @@ int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Mess
//glm::uint Ulp = 0;
//Ulp = glm::max(glm::float_distance(*Dst, *Src), Ulp);
printf("inverse<%s>(%f): %lu\n", Message, static_cast<double>(Diff), EndTime - StartTime);
std::printf("inverse<%s>(%f): %lu\n", Message, static_cast<double>(Diff), EndTime - StartTime);
return 0;
}

View File

@@ -799,7 +799,7 @@ int main()
glm::ivec4 const g2 = *reinterpret_cast<glm::ivec4 const* const>(&f2);
printf("GNI\n");
std::printf("GNI\n");
}
{
@@ -819,7 +819,7 @@ int main()
glm::uvec4 const g2 = *reinterpret_cast<glm::uvec4 const* const>(&f2);
printf("GNI\n");
std::printf("GNI\n");
}
*/