mirror of
https://github.com/g-truc/glm.git
synced 2024-12-01 20:24:38 +00:00
Fixed glm::log2<int>() returns wrong value, missing static assert #683
This commit is contained in:
parent
5606dd1aac
commit
1bf24f8344
@ -25,6 +25,8 @@ namespace detail
|
|||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
|
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'log2' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||||
|
|
||||||
return detail::functor1<L, T, T, Q>::call(log2, v);
|
return detail::functor1<L, T, T, Q>::call(log2, v);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,15 +35,6 @@ namespace glm
|
|||||||
template<typename genIUType>
|
template<typename genIUType>
|
||||||
GLM_FUNC_DECL genIUType log2(genIUType x);
|
GLM_FUNC_DECL genIUType log2(genIUType x);
|
||||||
|
|
||||||
template<typename genIUType>
|
|
||||||
GLM_FUNC_DECL genIUType mod(genIUType x, genIUType y);
|
|
||||||
|
|
||||||
template<length_t L, typename T, qualifier Q>
|
|
||||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, T y);
|
|
||||||
|
|
||||||
template<length_t L, typename T, qualifier Q>
|
|
||||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
|
||||||
|
|
||||||
/// Returns a value equal to the nearest integer to x.
|
/// Returns a value equal to the nearest integer to x.
|
||||||
/// The fraction 0.5 will round in a direction chosen by the
|
/// The fraction 0.5 will round in a direction chosen by the
|
||||||
/// implementation, presumably the direction that is fastest.
|
/// implementation, presumably the direction that is fastest.
|
||||||
|
@ -26,7 +26,7 @@ namespace log2_
|
|||||||
glm::ivec3 D0(glm::log2(glm::vec3(16.f)));
|
glm::ivec3 D0(glm::log2(glm::vec3(16.f)));
|
||||||
glm::ivec4 E0(glm::log2(glm::vec4(16.f)));
|
glm::ivec4 E0(glm::log2(glm::vec4(16.f)));
|
||||||
|
|
||||||
int A1 = glm::log2(int(16));
|
int A1 = glm::log2(int(1024));
|
||||||
glm::ivec1 B1 = glm::log2(glm::ivec1(16));
|
glm::ivec1 B1 = glm::log2(glm::ivec1(16));
|
||||||
glm::ivec2 C1 = glm::log2(glm::ivec2(16));
|
glm::ivec2 C1 = glm::log2(glm::ivec2(16));
|
||||||
glm::ivec3 D1 = glm::log2(glm::ivec3(16));
|
glm::ivec3 D1 = glm::log2(glm::ivec3(16));
|
||||||
|
Loading…
Reference in New Issue
Block a user