Selaa lähdekoodia

Fixed glm::log2<int>() returns wrong value, missing static assert #683

Christophe Riccio 8 vuotta sitten
vanhempi
sitoutus
1bf24f8344
3 muutettua tiedostoa jossa 3 lisäystä ja 10 poistoa
  1. 2 0
      glm/detail/func_exponential.inl
  2. 0 9
      glm/gtc/integer.hpp
  3. 1 1
      test/gtc/gtc_integer.cpp

+ 2 - 0
glm/detail/func_exponential.inl

@@ -25,6 +25,8 @@ namespace detail
 	{
 		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);
 		}
 	};

+ 0 - 9
glm/gtc/integer.hpp

@@ -35,15 +35,6 @@ namespace glm
 	template<typename genIUType>
 	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.
 	/// The fraction 0.5 will round in a direction chosen by the
 	/// implementation, presumably the direction that is fastest.

+ 1 - 1
test/gtc/gtc_integer.cpp

@@ -26,7 +26,7 @@ namespace log2_
 		glm::ivec3 D0(glm::log2(glm::vec3(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::ivec2 C1 = glm::log2(glm::ivec2(16));
 		glm::ivec3 D1 = glm::log2(glm::ivec3(16));