Browse Source

Added float_or_int_trait

Christophe Riccio 14 years ago
parent
commit
620861973e
1 changed files with 85 additions and 1 deletions
  1. 85 1
      glm/core/_detail.hpp

+ 85 - 1
glm/core/_detail.hpp

@@ -345,8 +345,92 @@ namespace detail
 	typedef float								float32;
 	typedef float								float32;
 	typedef double								float64;
 	typedef double								float64;
 	
 	
-}//namespace detail
+	//////////////////
+	// float_or_int_trait 
+
+	struct float_or_int_value
+	{
+		enum
+		{
+			ERROR,
+			FLOAT,
+			INT
+		};
+	};
+
+	template <typename T>
+	struct float_or_int_trait
+	{
+		enum{ID = float_or_int_value::ERROR};
+	};
+
+	template <>
+	struct float_or_int_trait<int8>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<int16>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<int32>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<int64>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<uint8>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<uint16>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<uint32>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<uint64>
+	{
+		enum{ID = float_or_int_value::INT};
+	};
+
+	template <>
+	struct float_or_int_trait<float16>
+	{
+		enum{ID = float_or_int_value::FLOAT};
+	};
+
+	template <>
+	struct float_or_int_trait<float32>
+	{
+		enum{ID = float_or_int_value::FLOAT};
+	};
 
 
+	template <>
+	struct float_or_int_trait<float64>
+	{
+		enum{ID = float_or_int_value::FLOAT};
+	};
+
+}//namespace detail
 }//namespace glm
 }//namespace glm
 
 
 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))