Merge pull request #466 from humbletim/master

Fixed ldexp compilation error #466
This commit is contained in:
Christophe R 2016-01-01 14:34:04 +01:00
commit 8d4d9d1877
3 changed files with 41 additions and 2 deletions

View File

@ -706,7 +706,7 @@ namespace detail
frexp(x.w, exp.w));
}
template <typename genType, precision P>
template <typename genType>
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");

View File

@ -69,7 +69,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
##### Fixes:
- Fixed GTX_extended_min_max filename typo #386
- Fixed intersectRayTriangle to not do any unintentional backface culling
- Fixed frexp compilation error
- Fixed ldexp and frexp compilation errors
#### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX
##### Fixes:

View File

@ -1195,6 +1195,44 @@ namespace frexp_
}
}//namespace frexp_
namespace ldexp_
{
int test()
{
int Error(0);
{
glm::vec1 A = glm::vec1(0.5);
glm::ivec1 exp = glm::ivec1(11);
glm::vec1 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec1(1024),0.00001f)) ? 0 : 1;
}
{
glm::vec2 A = glm::vec2(0.5, 0.96);
glm::ivec2 exp = glm::ivec2(11, -2);
glm::vec2 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec2(1024, .24),0.00001f)) ? 0 : 1;
}
{
glm::vec3 A = glm::vec3(0.5, 0.96, 0.0);
glm::ivec3 exp = glm::ivec3(11, -2, 0);
glm::vec3 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec3(1024, .24, 0),0.00001f)) ? 0 : 1;
}
{
glm::vec4 A = glm::vec4(0.5, 0.96, 0.0, -0.665);
glm::ivec4 exp = glm::ivec4(11, -2, 0, 1);
glm::vec4 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1;
}
return Error;
}
}//namespace ldexp_
int main()
{
int Error(0);
@ -1214,6 +1252,7 @@ int main()
Error += isnan_::test();
Error += isinf_::test();
Error += frexp_::test();
Error += ldexp_::test();
# ifdef NDEBUG
std::size_t Samples = 1000;