diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index f5c1d2e7..052e0b62 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -87,29 +87,32 @@ namespace glm VECTORIZE_VEC(exp2) -namespace detail +namespace _detail { - template - struct compute_log2 + template + struct _compute_log2 { template - T operator() (T const & Value) const + T operator() (T const & Value) const; +/* { GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include for integer types support. Others types are not supported."); return Value; } +*/ }; template <> - struct compute_log2 + struct _compute_log2 { template T operator() (T const & Value) const { - return ::std::log(Value) / T(0.69314718055994530941723212145818); + return T(::std::log(Value)) / T(0.69314718055994530941723212145818); } }; -}//namespace detail + +}//namespace _detail // log2, ln2 = 0.69314718055994530941723212145818f template @@ -119,7 +122,7 @@ namespace detail ) { assert(x > genType(0)); // log2 is only defined on the range (0, inf] - return detail::compute_log2::ID>()(x); + return _detail::_compute_log2::ID>()(x); } VECTORIZE_VEC(log2) diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 98176043..f879df59 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -17,13 +17,15 @@ namespace detail struct compute_linearRand { template - GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const + GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const; +/* { GLM_STATIC_ASSERT(0, "'linearRand' invalid template parameter type. GLM_GTC_random only supports floating-point template types."); return Min; } +*/ }; - + template <> GLM_FUNC_QUALIFIER half compute_linearRand::operator() (half const & Min, half const & Max) const { @@ -41,6 +43,12 @@ namespace detail { return double(std::rand()) / double(RAND_MAX) * (Max - Min) + Min; } + + template <> + GLM_FUNC_QUALIFIER long double compute_linearRand::operator() (long double const & Min, long double const & Max) const + { + return (long double)(std::rand()) / (long double)(RAND_MAX) * (Max - Min) + Min; + } }//namespace detail template diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index 73e730c8..851fdc6a 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -38,7 +38,7 @@ namespace glm } // Henry Gordon Dietz: http://aggregate.org/MAGIC/ -namespace detail +namespace _detail { GLM_FUNC_QUALIFIER unsigned int ones32(unsigned int x) { @@ -55,7 +55,7 @@ namespace detail } template <> - struct compute_log2 + struct _compute_log2 { template T operator() (T const & Value) const @@ -67,7 +67,8 @@ namespace detail #endif } }; -}//namespace detail + +}//namespace _detail // Henry Gordon Dietz: http://aggregate.org/MAGIC/ unsigned int floor_log2(unsigned int x) @@ -78,7 +79,7 @@ namespace detail x |= (x >> 8); x |= (x >> 16); - return(detail::ones32(x) - 1); + return(_detail::ones32(x) - 1); } // mod diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 56f068fc..88c6b00c 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -7,12 +7,13 @@ // File : test/core/func_common.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// -#include -#include -#include #include #include #include +#include +#include +#include +#include int test_modf() {