Browse Source

Declare specialized floattoXint functions

Christophe Riccio 14 years ago
parent
commit
78ab122ae0
1 changed files with 31 additions and 25 deletions
  1. 31 25
      glm/core/func_common.inl

+ 31 - 25
glm/core/func_common.inl

@@ -1300,6 +1300,7 @@ namespace glm
             isnan(x.w));
             isnan(x.w));
     }
     }
 
 
+	template <>
 	GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value)
 	GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value)
 	{
 	{
 		union
 		union
@@ -1312,10 +1313,10 @@ namespace glm
 		return fi.i;
 		return fi.i;
 	}
 	}
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec2<int> floatBitsToInt
     GLM_FUNC_QUALIFIER detail::tvec2<int> floatBitsToInt
 	(
 	(
-		detail::tvec2<T> const & value
+		detail::tvec2<float> const & value
 	)
 	)
     {
     {
         return detail::tvec2<int>(
         return detail::tvec2<int>(
@@ -1323,28 +1324,32 @@ namespace glm
             floatBitsToInt(value.y));
             floatBitsToInt(value.y));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec3<int> floatBitsToInt
     GLM_FUNC_QUALIFIER detail::tvec3<int> floatBitsToInt
 	(
 	(
-		detail::tvec3<T> const & value
+		detail::tvec3<float> const & value
 	)
 	)
     {
     {
         return detail::tvec3<int>(
         return detail::tvec3<int>(
             floatBitsToInt(value.x),
             floatBitsToInt(value.x),
-            floatBitsToInt(value.y));
+			floatBitsToInt(value.y),
+			floatBitsToInt(value.z));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec4<int> floatBitsToInt
     GLM_FUNC_QUALIFIER detail::tvec4<int> floatBitsToInt
 	(
 	(
-		detail::tvec4<T> const & value
+		detail::tvec4<float> const & value
 	)
 	)
     {
     {
         return detail::tvec4<int>(
         return detail::tvec4<int>(
             floatBitsToInt(value.x),
             floatBitsToInt(value.x),
-            floatBitsToInt(value.y));
+			floatBitsToInt(value.y),
+			floatBitsToInt(value.z),
+			floatBitsToInt(value.w));
     }
     }
 
 
+	template<>
 	GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value)
 	GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value)
 	{
 	{
 		union
 		union
@@ -1357,10 +1362,10 @@ namespace glm
 		return fu.u;
 		return fu.u;
 	}
 	}
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec2<uint> floatBitsToUint
     GLM_FUNC_QUALIFIER detail::tvec2<uint> floatBitsToUint
 	(
 	(
-		detail::tvec2<T> const & value
+		detail::tvec2<float> const & value
 	)
 	)
     {
     {
         return detail::tvec2<uint>(
         return detail::tvec2<uint>(
@@ -1368,10 +1373,10 @@ namespace glm
             floatBitsToUint(value.y));
             floatBitsToUint(value.y));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec3<uint> floatBitsToUint
     GLM_FUNC_QUALIFIER detail::tvec3<uint> floatBitsToUint
 	(
 	(
-		detail::tvec3<T> const & value
+		detail::tvec3<float> const & value
 	)
 	)
     {
     {
         return detail::tvec3<uint>(
         return detail::tvec3<uint>(
@@ -1380,10 +1385,10 @@ namespace glm
 			floatBitsToUint(value.z));
 			floatBitsToUint(value.z));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec4<uint> floatBitsToUint
     GLM_FUNC_QUALIFIER detail::tvec4<uint> floatBitsToUint
 	(
 	(
-		detail::tvec4<T> const & value
+		detail::tvec4<float> const & value
 	)
 	)
     {
     {
         return detail::tvec4<uint>(
         return detail::tvec4<uint>(
@@ -1405,10 +1410,10 @@ namespace glm
 		return fi.f;
 		return fi.f;
 	}
 	}
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec2<float> intBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec2<float> intBitsToFloat
 	(
 	(
-		detail::tvec2<T> const & value
+		detail::tvec2<int> const & value
 	)
 	)
     {
     {
         return detail::tvec2<float>(
         return detail::tvec2<float>(
@@ -1416,10 +1421,10 @@ namespace glm
             intBitsToFloat(value.y));
             intBitsToFloat(value.y));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec3<float> intBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec3<float> intBitsToFloat
 	(
 	(
-		detail::tvec3<T> const & value
+		detail::tvec3<int> const & value
 	)
 	)
     {
     {
         return detail::tvec3<float>(
         return detail::tvec3<float>(
@@ -1428,7 +1433,7 @@ namespace glm
 			intBitsToFloat(value.z));
 			intBitsToFloat(value.z));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec4<float> intBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec4<float> intBitsToFloat
 	(
 	(
 		detail::tvec4<T> const & value
 		detail::tvec4<T> const & value
@@ -1441,6 +1446,7 @@ namespace glm
 			intBitsToFloat(value.w));
 			intBitsToFloat(value.w));
     }
     }
 
 
+	template<>
     GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value)
     GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value)
     {
     {
         union
         union
@@ -1453,10 +1459,10 @@ namespace glm
         return fu.f;
         return fu.f;
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec2<float> uintBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec2<float> uintBitsToFloat
 	(
 	(
-		detail::tvec2<T> const & value
+		detail::tvec2<uint> const & value
 	)
 	)
     {
     {
         return detail::tvec2<float>(
         return detail::tvec2<float>(
@@ -1464,10 +1470,10 @@ namespace glm
             uintBitsToFloat(value.y));
             uintBitsToFloat(value.y));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec3<float> uintBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec3<float> uintBitsToFloat
 	(
 	(
-		detail::tvec3<T> const & value
+		detail::tvec3<uint> const & value
 	)
 	)
     {
     {
         return detail::tvec3<float>(
         return detail::tvec3<float>(
@@ -1476,10 +1482,10 @@ namespace glm
 			uintBitsToFloat(value.z));
 			uintBitsToFloat(value.z));
     }
     }
 
 
-    template <typename T>
+    template <>
     GLM_FUNC_QUALIFIER detail::tvec4<float> uintBitsToFloat
     GLM_FUNC_QUALIFIER detail::tvec4<float> uintBitsToFloat
 	(
 	(
-		detail::tvec4<T> const & value
+		detail::tvec4<uint> const & value
 	)
 	)
     {
     {
         return detail::tvec4<float>(
         return detail::tvec4<float>(