diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index c8c385f7..c1ffee92 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -224,6 +224,30 @@ namespace glm exp2(x.w)); } +namespace detail +{ + template + struct compute_log2 + { + template + T operator() (T const & Value) const + { + static_assert(0, "'log2' parameter has an invalid template parameter type"); + return Value; + } + }; + + template <> + struct compute_log2 + { + template + T operator() (T const & Value) const + { + return ::std::log(Value) / T(0.69314718055994530941723212145818); + } + }; +}//namespace detail + // log2, ln2 = 0.69314718055994530941723212145818f template GLM_FUNC_QUALIFIER genType log2 @@ -231,9 +255,7 @@ namespace glm genType const & x ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'log2' only accept floating-point input"); - - return ::std::log(x) / genType(0.69314718055994530941723212145818); + return detail::compute_log2::ID>()(x); } template