Merge branch 'maintenance' into experimental

This commit is contained in:
Christophe Riccio 2010-04-14 22:19:04 +01:00
commit a67ecdc4ba
3 changed files with 42 additions and 40 deletions

View File

@ -7,7 +7,6 @@ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_subdirectory(glm)
add_subdirectory(doc)
add_subdirectory(sample)
add_subdirectory(test)

View File

@ -28,8 +28,8 @@ namespace glm
)
{
detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y);
genUType Result = genUType(Value64 % (1 << 32));
Carry = (Value64 % (1 << 32)) > 1 : 1 : 0;
genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32)));
Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0;
return Result;
}
@ -88,7 +88,7 @@ namespace glm
if(x > y)
return genUType(detail::highp_int_t(x) - detail::highp_int_t(y));
else
return genUType(detail::highp_int_t(1 << 32) + detail::highp_int_t(x) - detail::highp_int_t(y));
return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y));
}
template <typename T>
@ -146,8 +146,8 @@ namespace glm
detail::highp_uint_t ValueX64 = x;
detail::highp_uint_t ValueY64 = y;
detail::highp_uint_t Value64 = ValueX64 * ValueY64;
msb = *(genUType*)&(Value64 & ((1 << 32) - 1));
lsb = *(genUType*)&(Value64 >> 32);
msb = *(genUType*)&(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1)));
lsb = *(genUType*)&(Value64 >> detail::highp_uint_t(32));
}
template <typename T>
@ -208,8 +208,8 @@ namespace glm
detail::highp_int_t ValueX64 = x;
detail::highp_int_t ValueY64 = y;
detail::highp_int_t Value64 = ValueX64 * ValueY64;
msb = *(genIType*)&(Value64 & ((1 << 32) - 1));
lsb = *(genIType*)&(Value64 >> 32);
msb = *(genIType*)&(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1)));
lsb = *(genIType*)&(Value64 >> detail::highp_uint_t(32));
}
template <typename T>
@ -267,7 +267,7 @@ namespace glm
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer);
GLM_STATIC_ASSERT(Offset + Bits <= sizeof(genIUType));
assert(Offset + Bits <= sizeof(genIUType));
genIUType Result = 0;
if(std::numeric_limits<genIUType>::is_signed)
@ -289,8 +289,8 @@ namespace glm
)
{
return detail::tvec2<T>(
bitfieldExtract(value[0]),
bitfieldExtract(value[1]));
bitfieldExtract(Value[0]),
bitfieldExtract(Value[1]));
}
template <typename T>
@ -302,9 +302,9 @@ namespace glm
)
{
return detail::tvec3<T>(
bitfieldExtract(value[0]),
bitfieldExtract(value[1]),
bitfieldExtract(value[2]));
bitfieldExtract(Value[0]),
bitfieldExtract(Value[1]),
bitfieldExtract(Value[2]));
}
template <typename T>
@ -316,10 +316,10 @@ namespace glm
)
{
return detail::tvec4<T>(
bitfieldExtract(value[0]),
bitfieldExtract(value[1]),
bitfieldExtract(value[2]),
bitfieldExtract(value[3]));
bitfieldExtract(Value[0]),
bitfieldExtract(Value[1]),
bitfieldExtract(Value[2]),
bitfieldExtract(Value[3]));
}
// bitfieldInsert
@ -333,7 +333,7 @@ namespace glm
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer);
GLM_STATIC_ASSERT(Offset + Bits <= sizeof(genIUType));
assert(Offset + Bits <= sizeof(genIUType));
if(Bits == 0)
return Base;
@ -355,8 +355,8 @@ namespace glm
)
{
return detail::tvec2<T>(
bitfieldInsert(value[0]),
bitfieldInsert(value[1]));
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
bitfieldInsert(Base[1], Insert[1], Offset, Bits));
}
template <typename T>
@ -369,9 +369,9 @@ namespace glm
)
{
return detail::tvec3<T>(
bitfieldInsert(value[0]),
bitfieldInsert(value[1]),
bitfieldInsert(value[2]));
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
bitfieldInsert(Base[2], Insert[2], Offset, Bits));
}
template <typename T>
@ -384,10 +384,10 @@ namespace glm
)
{
return detail::tvec4<T>(
bitfieldInsert(value[0]),
bitfieldInsert(value[1]),
bitfieldInsert(value[2]),
bitfieldInsert(value[3]));
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
bitfieldInsert(Base[2], Insert[2], Offset, Bits),
bitfieldInsert(Base[3], Insert[3], Offset, Bits));
}
// bitfieldReverse
@ -399,7 +399,7 @@ namespace glm
genIUType Result = 0;
for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
if(Value & (1 << i))
Result |= (1 << (sizeof(genIUType) * std::size_t(8)) - 1 - i);
Result |= (genIUType(1) << (sizeof(genIUType) * std::size_t(8)) - genIUType(1) - i);
return Result;
}
@ -491,18 +491,18 @@ namespace glm
}
// findLSB
template <typename genType>
template <typename genIUType>
inline int findLSB
(
genType const & Value
genIUType const & Value
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer);
if(Value == 0)
return -1;
genType Bit;
for(Bit = genType(0); !(Value & (1 << Bit)); ++Bit){}
genIUType Bit;
for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){}
return Bit;
}
@ -543,18 +543,18 @@ namespace glm
}
// findMSB
template <typename genType>
template <typename genIUType>
inline int findMSB
(
genType const & value
genIUType const & Value
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer);
if(Value == 0)
return -1;
genType bit = genType(-1);
for(genType tmp = value; tmp; tmp >>= 1, ++bit){}
genIUType bit = genIUType(-1);
for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){}
return bit;
}

View File

@ -14,7 +14,10 @@
// Version
#define GLM_VERSION 90
#define GLM_REVISION 1040
#define GLM_VERSION_MAJOR 0
#define GLM_VERSION_MINOR 9
#define GLM_VERSION_PATCH B
#define GLM_VERSION_REVISION 2
///////////////////////////////////////////////////////////////////////////////////////////////////
// Common values
@ -238,8 +241,8 @@
// To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
// GLM_USE_ANONYMOUS_UNION
#if(defined(GLM_USE_ANONYMOUS_UNION) && (GLM_COMPILER & GLM_COMPILER_GCC))
#error GLM_USE_ANONYMOUS_UNION is defined to use anonymous union implementation of vector types. Anonymous unions can't be used with GCC.
#if(defined(GLM_USE_ANONYMOUS_UNION) && !(GLM_COMPILER & GLM_COMPILER_VC))
#error "GLM_USE_ANONYMOUS_UNION is defined to use anonymous union implementation of vector types. Anonymous unions can't be used with GCC."
#endif//GLM_USE_ANONYMOUS_UNION
///////////////////////////////////////////////////////////////////////////////////////////////////