Browse Source

Fixed assert

Christophe Riccio 14 years ago
parent
commit
af2a12f1dc
1 changed files with 46 additions and 46 deletions
  1. 46 46
      glm/core/func_integer.inl

+ 46 - 46
glm/core/func_integer.inl

@@ -20,7 +20,7 @@ namespace glm
 	{
 		// uaddCarry
 		template <typename genUType>
-		inline genUType uaddCarry
+		GLM_FUNC_QUALIFIER genUType uaddCarry
 		(
 			genUType const & x, 
 			genUType const & y, 
@@ -34,7 +34,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> uaddCarry
+		GLM_FUNC_QUALIFIER detail::tvec2<T> uaddCarry
 		(
 			detail::tvec2<T> const & x, 
 			detail::tvec2<T> const & y, 
@@ -47,7 +47,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> uaddCarry
+		GLM_FUNC_QUALIFIER detail::tvec3<T> uaddCarry
 		(
 			detail::tvec3<T> const & x, 
 			detail::tvec3<T> const & y, 
@@ -61,7 +61,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> uaddCarry
+		GLM_FUNC_QUALIFIER detail::tvec4<T> uaddCarry
 		(
 			detail::tvec4<T> const & x, 
 			detail::tvec4<T> const & y, 
@@ -77,7 +77,7 @@ namespace glm
 
 		// usubBorrow
 		template <typename genUType>
-		inline genUType usubBorrow
+		GLM_FUNC_QUALIFIER genUType usubBorrow
 		(
 			genUType const & x, 
 			genUType const & y, 
@@ -92,7 +92,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> usubBorrow
+		GLM_FUNC_QUALIFIER detail::tvec2<T> usubBorrow
 		(
 			detail::tvec2<T> const & x, 
 			detail::tvec2<T> const & y, 
@@ -105,7 +105,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> usubBorrow
+		GLM_FUNC_QUALIFIER detail::tvec3<T> usubBorrow
 		(
 			detail::tvec3<T> const & x, 
 			detail::tvec3<T> const & y, 
@@ -119,7 +119,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> usubBorrow
+		GLM_FUNC_QUALIFIER detail::tvec4<T> usubBorrow
 		(
 			detail::tvec4<T> const & x, 
 			detail::tvec4<T> const & y, 
@@ -135,7 +135,7 @@ namespace glm
 
 		// umulExtended
 		template <typename genUType>
-		inline void umulExtended
+		GLM_FUNC_QUALIFIER void umulExtended
 		(
 			genUType const & x, 
 			genUType const & y, 
@@ -151,7 +151,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> umulExtended
+		GLM_FUNC_QUALIFIER detail::tvec2<T> umulExtended
 		(
 			detail::tvec2<T> const & x, 
 			detail::tvec2<T> const & y, 
@@ -165,7 +165,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> umulExtended
+		GLM_FUNC_QUALIFIER detail::tvec3<T> umulExtended
 		(
 			detail::tvec3<T> const & x, 
 			detail::tvec3<T> const & y, 
@@ -180,7 +180,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> umulExtended
+		GLM_FUNC_QUALIFIER detail::tvec4<T> umulExtended
 		(
 			detail::tvec4<T> const & x, 
 			detail::tvec4<T> const & y, 
@@ -213,7 +213,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> imulExtended
+		GLM_FUNC_QUALIFIER detail::tvec2<T> imulExtended
 		(
 			detail::tvec2<T> const & x, 
 			detail::tvec2<T> const & y, 
@@ -227,7 +227,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> imulExtended
+		GLM_FUNC_QUALIFIER detail::tvec3<T> imulExtended
 		(
 			detail::tvec3<T> const & x, 
 			detail::tvec3<T> const & y, 
@@ -242,7 +242,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> imulExtended
+		GLM_FUNC_QUALIFIER detail::tvec4<T> imulExtended
 		(
 			detail::tvec4<T> const & x, 
 			detail::tvec4<T> const & y, 
@@ -267,21 +267,21 @@ namespace glm
 		)
 		{
 			GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldExtract' only accept integer values");
-			assert(Offset + Bits <= sizeof(genIUType));
+			assert(Offset + Bits <= (sizeof(genIUType) << 3));
 
-			genIUType Result = 0;
+			genIUType Result(0);
 			if(std::numeric_limits<genIUType>::is_signed)
-				Result |= (1 << (sizeof(genIUType) * 8 - 1)) & (1 << (Offset + Bits - 1));
+				Result |= (genIUType(1) << (sizeof(genIUType) * genIUType(8) - genIUType(1))) & (genIUType(1) << (Offset + Bits - genIUType(1)));
 
-			genIUType Mask = 0;
+			genIUType Mask(0);
 			for(int Bit = Offset; Bit < Bits; ++Bit)
-				Mask |= (1 << Bit);
+				Mask |= (genIUType(1) << Bit);
 
 			return Result | ((Mask & Value) >> Offset);
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> bitfieldExtract
+		GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldExtract
 		(
 			detail::tvec2<T> const & Value, 
 			int const & Offset, 
@@ -294,7 +294,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> bitfieldExtract
+		GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldExtract
 		(
 			detail::tvec3<T> const & Value, 
 			int const & Offset, 
@@ -308,7 +308,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> bitfieldExtract
+		GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldExtract
 		(
 			detail::tvec4<T> const & Value, 
 			int const & Offset, 
@@ -324,7 +324,7 @@ namespace glm
 
 		// bitfieldInsert
 		template <typename genIUType>
-		inline genIUType bitfieldInsert
+		GLM_FUNC_QUALIFIER genIUType bitfieldInsert
 		(
 			genIUType const & Base, 
 			genIUType const & Insert, 
@@ -340,13 +340,13 @@ namespace glm
 
 			genIUType Mask = 0;
 			for(int Bit = Offset; Bit < Offset + Bits; ++Bit)
-				Mask |= (1 << Bit);
+				Mask |= (genIUType(1) << Bit);
 
 			return (Base & ~Mask) | (Insert & Mask);
 		}
 
 		template <typename T>
-		inline detail::tvec2<T> bitfieldInsert
+		GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldInsert
 		(
 			detail::tvec2<T> const & Base, 
 			detail::tvec2<T> const & Insert, 
@@ -360,7 +360,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> bitfieldInsert
+		GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldInsert
 		(
 			detail::tvec3<T> const & Base, 
 			detail::tvec3<T> const & Insert, 
@@ -375,7 +375,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> bitfieldInsert
+		GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldInsert
 		(
 			detail::tvec4<T> const & Base, 
 			detail::tvec4<T> const & Insert, 
@@ -392,19 +392,19 @@ namespace glm
 
 		// bitfieldReverse
 		template <typename genIUType>
-		inline genIUType bitfieldReverse(genIUType const & Value)
+		GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value)
 		{
 			GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldReverse' only accept integer values");
 
 			genIUType Result = 0;
 			for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
-				if(Value & (1 << i))
-					Result |= (genIUType(1) << (sizeof(genIUType) * std::size_t(8)) - genIUType(1) - i);
+				if(Value & (genIUType(1) << genIUType(i)))
+					Result |= (genIUType(1) << (genIUType(sizeof(genIUType)) * genIUType(8)) - genIUType(1) - genIUType(i));
 			return Result;
 		}	
 
 		template <typename T>
-		inline detail::tvec2<T> bitfieldReverse
+		GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldReverse
 		(
 			detail::tvec2<T> const & value
 		)
@@ -415,7 +415,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<T> bitfieldReverse
+		GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldReverse
 		(
 			detail::tvec3<T> const & value
 		)
@@ -427,7 +427,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<T> bitfieldReverse
+		GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldReverse
 		(
 			detail::tvec4<T> const & value
 		)
@@ -448,14 +448,14 @@ namespace glm
 			int Count = 0;
 			for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
 			{
-				if(Value & (1 << i))
+				if(Value & (genIUType(1) << i))
 					++Count;
 			}
 			return Count;
 		}
 
 		template <typename T>
-		inline detail::tvec2<int> bitCount
+		GLM_FUNC_QUALIFIER detail::tvec2<int> bitCount
 		(
 			detail::tvec2<T> const & value
 		)
@@ -466,7 +466,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<int> bitCount
+		GLM_FUNC_QUALIFIER detail::tvec3<int> bitCount
 		(
 			detail::tvec3<T> const & value
 		)
@@ -478,7 +478,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<int> bitCount
+		GLM_FUNC_QUALIFIER detail::tvec4<int> bitCount
 		(
 			detail::tvec4<T> const & value
 		)
@@ -492,7 +492,7 @@ namespace glm
 
 		// findLSB
 		template <typename genIUType>
-		inline int findLSB
+		GLM_FUNC_QUALIFIER int findLSB
 		(
 			genIUType const & Value
 		)
@@ -507,7 +507,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<int> findLSB
+		GLM_FUNC_QUALIFIER detail::tvec2<int> findLSB
 		(
 			detail::tvec2<T> const & value
 		)
@@ -518,7 +518,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<int> findLSB
+		GLM_FUNC_QUALIFIER detail::tvec3<int> findLSB
 		(
 			detail::tvec3<T> const & value
 		)
@@ -530,7 +530,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<int> findLSB
+		GLM_FUNC_QUALIFIER detail::tvec4<int> findLSB
 		(
 			detail::tvec4<T> const & value
 		)
@@ -544,7 +544,7 @@ namespace glm
 
 		// findMSB
 		template <typename genIUType>
-		inline int findMSB
+		GLM_FUNC_QUALIFIER int findMSB
 		(
 			genIUType const & Value
 		)
@@ -559,7 +559,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec2<int> findMSB
+		GLM_FUNC_QUALIFIER detail::tvec2<int> findMSB
 		(
 			detail::tvec2<T> const & value
 		)
@@ -570,7 +570,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec3<int> findMSB
+		GLM_FUNC_QUALIFIER detail::tvec3<int> findMSB
 		(
 			detail::tvec3<T> const & value
 		)
@@ -582,7 +582,7 @@ namespace glm
 		}
 
 		template <typename T>
-		inline detail::tvec4<int> findMSB
+		GLM_FUNC_QUALIFIER detail::tvec4<int> findMSB
 		(
 			detail::tvec4<T> const & value
 		)