Added bit interleave for 3 and 4 integers

This commit is contained in:
Christophe Riccio
2013-02-10 19:25:11 +01:00
parent 6799127ec6
commit bd7125c50b
4 changed files with 252 additions and 3 deletions

View File

@@ -11,6 +11,9 @@
#include <glm/gtc/random.hpp>
#include <glm/gtc/epsilon.hpp>
#include <iostream>
#if(GLM_LANG & GLM_LANG_CXX0X)
# include <array>
#endif
int test_linearRand()
{
@@ -136,6 +139,46 @@ int test_ballRand()
return Error;
}
#if(GLM_LANG & GLM_LANG_CXX0X)
int test_grid()
{
int Error = 0;
typedef std::array<int, 8> colors;
typedef std::array<int, 8 * 8> grid;
grid Grid;
colors Colors;
grid GridBest;
colors ColorsBest;
while(true)
{
for(std::size_t i = 0; i < Grid.size(); ++i)
Grid[i] = int(glm::linearRand(0.0, 8.0 * 8.0 * 8.0 - 1.0) / 64.0);
for(std::size_t i = 0; i < Grid.size(); ++i)
++Colors[Grid[i]];
bool Exit = true;
for(std::size_t i = 0; i < Colors.size(); ++i)
{
if(Colors[i] == 8)
continue;
Exit = false;
break;
}
if(Exit == true)
break;
}
return Error;
}
#endif
int main()
{
int Error = 0;