Added iround and uround to GTC_integer, fast round on positive values

This commit is contained in:
Christophe Riccio
2016-03-10 21:53:08 +01:00
parent 52d05aee76
commit 86c58b8b8b
4 changed files with 51 additions and 2 deletions

View File

@@ -210,6 +210,24 @@ namespace log2_
}
}//namespace log2_
namespace iround
{
int test()
{
int Error = 0;
for(float f = 0.0f; f < 3.1f; f += 0.05f)
{
int RoundFast = glm::iround(f);
int RoundSTD = glm::round(f);
Error += RoundFast == RoundSTD ? 0 : 1;
assert(!Error);
}
return Error;
}
}//namespace iround
namespace uround
{
int test()
@@ -233,6 +251,7 @@ int main()
int Error(0);
Error += ::log2_::test();
Error += ::iround::test();
Error += ::uround::test();
# ifdef NDEBUG