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

@ -28,10 +28,10 @@ namespace detail
return std::string();
va_start(list, msg);
# if(GLM_COMPILER & GLM_COMPILER_VC)
# if (GLM_COMPILER & GLM_COMPILER_VC)
vsprintf_s(text, STRING_BUFFER, msg, list);
# else//
vsprintf(text, msg, list);
std::vsprintf(text, msg, list);
# endif//
va_end(list);

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");
}
*/

View File

@ -103,11 +103,11 @@ namespace mask
std::clock_t TimeZero = Timestamp5 - Timestamp4;
std::clock_t TimeHalf = Timestamp6 - Timestamp5;
printf("mask[mix]: %d\n", static_cast<unsigned int>(TimeMix));
printf("mask[loop]: %d\n", static_cast<unsigned int>(TimeLoop));
printf("mask[default]: %d\n", static_cast<unsigned int>(TimeDefault));
printf("mask[zero]: %d\n", static_cast<unsigned int>(TimeZero));
printf("mask[half]: %d\n", static_cast<unsigned int>(TimeHalf));
std::printf("mask[mix]: %d\n", static_cast<unsigned int>(TimeMix));
std::printf("mask[loop]: %d\n", static_cast<unsigned int>(TimeLoop));
std::printf("mask[default]: %d\n", static_cast<unsigned int>(TimeDefault));
std::printf("mask[zero]: %d\n", static_cast<unsigned int>(TimeZero));
std::printf("mask[half]: %d\n", static_cast<unsigned int>(TimeHalf));
return TimeDefault < TimeLoop ? 0 : 1;
}

View File

@ -68,7 +68,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<int>: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<int>: %d clocks\n", static_cast<int>(End - Begin));
}
{
@ -82,7 +82,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<ivec4>: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<ivec4>: %d clocks\n", static_cast<int>(End - Begin));
}
# if GLM_HAS_BITSCAN_WINDOWS
@ -104,7 +104,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<ivec4> inlined: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<ivec4> inlined: %d clocks\n", static_cast<int>(End - Begin));
}
@ -124,7 +124,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<ivec4> inlined no cast: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<ivec4> inlined no cast: %d clocks\n", static_cast<int>(End - Begin));
}
@ -144,7 +144,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<ivec4> reinterpret: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<ivec4> reinterpret: %d clocks\n", static_cast<int>(End - Begin));
}
# endif//GLM_HAS_BITSCAN_WINDOWS
@ -159,7 +159,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<float>: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<float>: %d clocks\n", static_cast<int>(End - Begin));
}
{
@ -173,7 +173,7 @@ namespace log2_
std::clock_t End = clock();
printf("glm::log2<vec4>: %d clocks\n", static_cast<int>(End - Begin));
std::printf("glm::log2<vec4>: %d clocks\n", static_cast<int>(End - Begin));
}
return Error;

View File

@ -15,46 +15,46 @@ void print_bits(float const& s)
uif.f = s;
printf("f32: ");
std::printf("f32: ");
for(std::size_t j = sizeof(s) * 8; j > 0; --j)
{
if(j == 23 || j == 31)
printf(" ");
printf("%d", (uif.i & (1 << (j - 1))) ? 1 : 0);
std::printf(" ");
std::printf("%d", (uif.i & (1 << (j - 1))) ? 1 : 0);
}
}
void print_10bits(glm::uint const& s)
{
printf("10b: ");
std::printf("10b: ");
for(std::size_t j = 10; j > 0; --j)
{
if(j == 5)
printf(" ");
printf("%d", (s & (1 << (j - 1))) ? 1 : 0);
std::printf(" ");
std::printf("%d", (s & (1 << (j - 1))) ? 1 : 0);
}
}
void print_11bits(glm::uint const& s)
{
printf("11b: ");
std::printf("11b: ");
for(std::size_t j = 11; j > 0; --j)
{
if(j == 6)
printf(" ");
printf("%d", (s & (1 << (j - 1))) ? 1 : 0);
std::printf(" ");
std::printf("%d", (s & (1 << (j - 1))) ? 1 : 0);
}
}
void print_value(float const& s)
{
printf("%2.5f, ", static_cast<double>(s));
std::printf("%2.5f, ", static_cast<double>(s));
print_bits(s);
printf(", ");
std::printf(", ");
// print_11bits(detail::floatTo11bit(s));
// printf(", ");
// std::printf(", ");
// print_10bits(detail::floatTo10bit(s));
printf("\n");
std::printf("\n");
}
int test_Half1x16()

View File

@ -33,10 +33,10 @@ int test_log2()
Error += glm::abs(double(A) - B) <= 24 ? 0 : 1;
assert(!Error);
printf("Log2(%d) error A=%d, B=%d\n", 1 << i, A, B);
std::printf("Log2(%d) error A=%d, B=%d\n", 1 << i, A, B);
}
printf("log2 error=%d\n", Error);
std::printf("log2 error=%d\n", Error);
return Error;
}

View File

@ -17,7 +17,7 @@ int test_decl()
glm::vec4 B;
};
printf("vec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
std::printf("vec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
}
@ -35,7 +35,7 @@ int test_decl()
glm::aligned_vec3 B;
};
printf("vec3 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
std::printf("vec3 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
Error += sizeof(S1) <= sizeof(S2) ? 0 : 1;
}
@ -53,7 +53,7 @@ int test_decl()
glm::vec4 B;
};
printf("vec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
std::printf("vec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
}
@ -71,7 +71,7 @@ int test_decl()
glm::dvec4 B;
};
printf("dvec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
std::printf("dvec4 - Aligned: %d, unaligned: %d\n", static_cast<int>(sizeof(S1)), static_cast<int>(sizeof(S2)));
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
}
@ -82,11 +82,11 @@ int test_decl()
template<typename genType>
void print(genType const& Mat0)
{
printf("mat4(\n");
printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[0][0]), static_cast<double>(Mat0[0][1]), static_cast<double>(Mat0[0][2]), static_cast<double>(Mat0[0][3]));
printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[1][0]), static_cast<double>(Mat0[1][1]), static_cast<double>(Mat0[1][2]), static_cast<double>(Mat0[1][3]));
printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[2][0]), static_cast<double>(Mat0[2][1]), static_cast<double>(Mat0[2][2]), static_cast<double>(Mat0[2][3]));
printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f))\n\n", static_cast<double>(Mat0[3][0]), static_cast<double>(Mat0[3][1]), static_cast<double>(Mat0[3][2]), static_cast<double>(Mat0[3][3]));
std::printf("mat4(\n");
std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[0][0]), static_cast<double>(Mat0[0][1]), static_cast<double>(Mat0[0][2]), static_cast<double>(Mat0[0][3]));
std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[1][0]), static_cast<double>(Mat0[1][1]), static_cast<double>(Mat0[1][2]), static_cast<double>(Mat0[1][3]));
std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f)\n", static_cast<double>(Mat0[2][0]), static_cast<double>(Mat0[2][1]), static_cast<double>(Mat0[2][2]), static_cast<double>(Mat0[2][3]));
std::printf("\tvec4(%2.9f, %2.9f, %2.9f, %2.9f))\n\n", static_cast<double>(Mat0[3][0]), static_cast<double>(Mat0[3][1]), static_cast<double>(Mat0[3][2]), static_cast<double>(Mat0[3][3]));
}
int perf_mul()

View File

@ -46,10 +46,10 @@ static int comp_mat2_div_mat2(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -73,10 +73,10 @@ static int comp_mat3_div_mat3(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -100,10 +100,10 @@ static int comp_mat4_div_mat4(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.05, 0.04, 0.02, 0.08, 0.05, 0.01, 0.08, 0.03, 0.05, 0.06, 0.02, 0.03, 0.07, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_div_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_div_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -122,22 +122,22 @@ int main()
int Error = 0;
printf("mat2 / mat2:\n");
std::printf("mat2 / mat2:\n");
Error += comp_mat2_div_mat2<glm::mat2, glm::aligned_mat2>(Samples);
printf("dmat2 / dmat2:\n");
std::printf("dmat2 / dmat2:\n");
Error += comp_mat2_div_mat2<glm::dmat2, glm::aligned_dmat2>(Samples);
printf("mat3 / mat3:\n");
std::printf("mat3 / mat3:\n");
Error += comp_mat3_div_mat3<glm::mat3, glm::aligned_mat3>(Samples);
printf("dmat3 / dmat3:\n");
std::printf("dmat3 / dmat3:\n");
Error += comp_mat3_div_mat3<glm::dmat3, glm::aligned_dmat3>(Samples);
printf("mat4 / mat4:\n");
std::printf("mat4 / mat4:\n");
Error += comp_mat4_div_mat4<glm::mat4, glm::aligned_mat4>(Samples);
printf("dmat4 / dmat4:\n");
std::printf("dmat4 / dmat4:\n");
Error += comp_mat4_div_mat4<glm::dmat4, glm::aligned_dmat4>(Samples);
return Error;

View File

@ -45,10 +45,10 @@ static int comp_mat2_inverse(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -71,10 +71,10 @@ static int comp_mat3_inverse(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -97,10 +97,10 @@ static int comp_mat4_inverse(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.05, 0.04, 0.02, 0.08, 0.05, 0.01, 0.08, 0.03, 0.05, 0.06, 0.02, 0.03, 0.07, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_inverse<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_inverse<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -119,22 +119,22 @@ int main()
int Error = 0;
printf("glm::inverse(mat2):\n");
std::printf("glm::inverse(mat2):\n");
Error += comp_mat2_inverse<glm::mat2, glm::aligned_mat2>(Samples);
printf("glm::inverse(dmat2):\n");
std::printf("glm::inverse(dmat2):\n");
Error += comp_mat2_inverse<glm::dmat2, glm::aligned_dmat2>(Samples);
printf("glm::inverse(mat3):\n");
std::printf("glm::inverse(mat3):\n");
Error += comp_mat3_inverse<glm::mat3, glm::aligned_mat3>(Samples);
printf("glm::inverse(dmat3):\n");
std::printf("glm::inverse(dmat3):\n");
Error += comp_mat3_inverse<glm::dmat3, glm::aligned_dmat3>(Samples);
printf("glm::inverse(mat4):\n");
std::printf("glm::inverse(mat4):\n");
Error += comp_mat4_inverse<glm::mat4, glm::aligned_mat4>(Samples);
printf("glm::inverse(dmat4):\n");
std::printf("glm::inverse(dmat4):\n");
Error += comp_mat4_inverse<glm::dmat4, glm::aligned_dmat4>(Samples);
return Error;

View File

@ -50,10 +50,10 @@ static int comp_mat2_mul_mat2(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -76,10 +76,10 @@ static int comp_mat3_mul_mat3(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -102,10 +102,10 @@ static int comp_mat4_mul_mat4(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_mat<packedMatType>(SISD, Transform, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_mat<alignedMatType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -123,22 +123,22 @@ int main()
int Error = 0;
printf("mat2 * mat2:\n");
std::printf("mat2 * mat2:\n");
Error += comp_mat2_mul_mat2<glm::mat2, glm::aligned_mat2>(Samples);
printf("dmat2 * dmat2:\n");
std::printf("dmat2 * dmat2:\n");
Error += comp_mat2_mul_mat2<glm::dmat2, glm::aligned_dmat2>(Samples);
printf("mat3 * mat3:\n");
std::printf("mat3 * mat3:\n");
Error += comp_mat3_mul_mat3<glm::mat3, glm::aligned_mat3>(Samples);
printf("dmat3 * dmat3:\n");
std::printf("dmat3 * dmat3:\n");
Error += comp_mat3_mul_mat3<glm::dmat3, glm::aligned_dmat3>(Samples);
printf("mat4 * mat4:\n");
std::printf("mat4 * mat4:\n");
Error += comp_mat4_mul_mat4<glm::mat4, glm::aligned_mat4>(Samples);
printf("dmat4 * dmat4:\n");
std::printf("dmat4 * dmat4:\n");
Error += comp_mat4_mul_mat4<glm::dmat4, glm::aligned_dmat4>(Samples);
return Error;

View File

@ -50,10 +50,10 @@ static int comp_mat2_mul_vec2(std::size_t Samples)
packedVecType const Scale(0.01, 0.02);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -76,10 +76,10 @@ static int comp_mat3_mul_vec3(std::size_t Samples)
packedVecType const Scale(0.01, 0.02, 0.05);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -102,10 +102,10 @@ static int comp_mat4_mul_vec4(std::size_t Samples)
packedVecType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_mul_vec<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_mul_vec<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -123,22 +123,22 @@ int main()
int Error = 0;
printf("mat2 * vec2:\n");
std::printf("mat2 * vec2:\n");
Error += comp_mat2_mul_vec2<glm::mat2, glm::vec2, glm::aligned_mat2, glm::aligned_vec2>(Samples);
printf("dmat2 * dvec2:\n");
std::printf("dmat2 * dvec2:\n");
Error += comp_mat2_mul_vec2<glm::dmat2, glm::dvec2,glm::aligned_dmat2, glm::aligned_dvec2>(Samples);
printf("mat3 * vec3:\n");
std::printf("mat3 * vec3:\n");
Error += comp_mat3_mul_vec3<glm::mat3, glm::vec3, glm::aligned_mat3, glm::aligned_vec3>(Samples);
printf("dmat3 * dvec3:\n");
std::printf("dmat3 * dvec3:\n");
Error += comp_mat3_mul_vec3<glm::dmat3, glm::dvec3, glm::aligned_dmat3, glm::aligned_dvec3>(Samples);
printf("mat4 * vec4:\n");
std::printf("mat4 * vec4:\n");
Error += comp_mat4_mul_vec4<glm::mat4, glm::vec4, glm::aligned_mat4, glm::aligned_vec4>(Samples);
printf("dmat4 * dvec4:\n");
std::printf("dmat4 * dvec4:\n");
Error += comp_mat4_mul_vec4<glm::dmat4, glm::dvec4, glm::aligned_dmat4, glm::aligned_dvec4>(Samples);
return Error;

View File

@ -45,10 +45,10 @@ static int comp_mat2_transpose(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -71,10 +71,10 @@ static int comp_mat3_transpose(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -97,10 +97,10 @@ static int comp_mat4_transpose(std::size_t Samples)
packedMatType const Scale(0.01, 0.02, 0.05, 0.04, 0.02, 0.08, 0.05, 0.01, 0.08, 0.03, 0.05, 0.06, 0.02, 0.03, 0.07, 0.05);
std::vector<packedMatType> SISD;
printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::printf("- SISD: %d us\n", launch_mat_transpose<packedMatType>(SISD, Scale, Samples));
std::vector<alignedMatType> SIMD;
printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_mat_transpose<alignedMatType>(SIMD, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -119,22 +119,22 @@ int main()
int Error = 0;
printf("glm::transpose(mat2):\n");
std::printf("glm::transpose(mat2):\n");
Error += comp_mat2_transpose<glm::mat2, glm::aligned_mat2>(Samples);
printf("glm::transpose(dmat2):\n");
std::printf("glm::transpose(dmat2):\n");
Error += comp_mat2_transpose<glm::dmat2, glm::aligned_dmat2>(Samples);
printf("glm::transpose(mat3):\n");
std::printf("glm::transpose(mat3):\n");
Error += comp_mat3_transpose<glm::mat3, glm::aligned_mat3>(Samples);
printf("glm::transpose(dmat3):\n");
std::printf("glm::transpose(dmat3):\n");
Error += comp_mat3_transpose<glm::dmat3, glm::aligned_dmat3>(Samples);
printf("glm::transpose(mat4):\n");
std::printf("glm::transpose(mat4):\n");
Error += comp_mat4_transpose<glm::mat4, glm::aligned_mat4>(Samples);
printf("glm::transpose(dmat4):\n");
std::printf("glm::transpose(dmat4):\n");
Error += comp_mat4_transpose<glm::dmat4, glm::aligned_dmat4>(Samples);
return Error;

View File

@ -50,10 +50,10 @@ static int comp_vec2_mul_mat2(std::size_t Samples)
packedVecType const Scale(0.01, 0.02);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -76,10 +76,10 @@ static int comp_vec3_mul_mat3(std::size_t Samples)
packedVecType const Scale(0.01, 0.02, 0.05);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -102,10 +102,10 @@ static int comp_vec4_mul_mat4(std::size_t Samples)
packedVecType const Scale(0.01, 0.02, 0.03, 0.05);
std::vector<packedVecType> SISD;
printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::printf("- SISD: %d us\n", launch_vec_mul_mat<packedMatType, packedVecType>(SISD, Transform, Scale, Samples));
std::vector<alignedVecType> SIMD;
printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
std::printf("- SIMD: %d us\n", launch_vec_mul_mat<alignedMatType, alignedVecType>(SIMD, Transform, Scale, Samples));
for(std::size_t i = 0; i < Samples; ++i)
{
@ -123,22 +123,22 @@ int main()
int Error = 0;
printf("vec2 * mat2:\n");
std::printf("vec2 * mat2:\n");
Error += comp_vec2_mul_mat2<glm::mat2, glm::vec2, glm::aligned_mat2, glm::aligned_vec2>(Samples);
printf("dvec2 * dmat2:\n");
std::printf("dvec2 * dmat2:\n");
Error += comp_vec2_mul_mat2<glm::dmat2, glm::dvec2,glm::aligned_dmat2, glm::aligned_dvec2>(Samples);
printf("vec3 * mat3:\n");
std::printf("vec3 * mat3:\n");
Error += comp_vec3_mul_mat3<glm::mat3, glm::vec3, glm::aligned_mat3, glm::aligned_vec3>(Samples);
printf("dvec3 * dmat3:\n");
std::printf("dvec3 * dmat3:\n");
Error += comp_vec3_mul_mat3<glm::dmat3, glm::dvec3, glm::aligned_dmat3, glm::aligned_dvec3>(Samples);
printf("vec4 * mat4:\n");
std::printf("vec4 * mat4:\n");
Error += comp_vec4_mul_mat4<glm::mat4, glm::vec4, glm::aligned_mat4, glm::aligned_vec4>(Samples);
printf("dvec4 * dmat4:\n");
std::printf("dvec4 * dmat4:\n");
Error += comp_vec4_mul_mat4<glm::dmat4, glm::dvec4, glm::aligned_dmat4, glm::aligned_dvec4>(Samples);
return Error;