Fixed 32-bits build #528 #529, fixed VC 32 bits crash

master
Christophe Riccio ago%!(EXTRA string=9 years)
parent e671d50e05
commit 0dbdf3fad4
  1. 2
      glm/detail/func_common.inl
  2. 25
      test/core/core_func_common.cpp
  3. 12
      test/gtc/gtc_bitfield.cpp

@ -190,7 +190,7 @@ namespace detail
# if GLM_ARCH == GLM_ARCH_X86 # if GLM_ARCH == GLM_ARCH_X86
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
struct compute_sign<T, P, vecType, Aligned> struct compute_sign<T, P, vecType, false, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
{ {

@ -955,12 +955,37 @@ namespace sign
return Error; return Error;
} }
int test_f32vec4()
{
type<glm::vec4> const Data[] =
{
{glm::vec4( 1), glm::vec4( 1)},
{glm::vec4( 0), glm::vec4( 0)},
{glm::vec4( 2), glm::vec4( 1)},
{glm::vec4( 3), glm::vec4( 1)},
{glm::vec4(-1), glm::vec4(-1)},
{glm::vec4(-2), glm::vec4(-1)},
{glm::vec4(-3), glm::vec4(-1)}
};
int Error = 0;
for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<glm::vec4>); ++i)
{
glm::vec4 Result = glm::sign(Data[i].Value);
Error += glm::all(glm::equal(Data[i].Return, Result)) ? 0 : 1;
}
return Error;
}
int test() int test()
{ {
int Error = 0; int Error = 0;
Error += test_int32(); Error += test_int32();
Error += test_i32vec4(); Error += test_i32vec4();
Error += test_f32vec4();
return Error; return Error;
} }

@ -318,7 +318,7 @@ namespace bitfieldInterleave
return REG1 | (REG2 << 1); return REG1 | (REG2 << 1);
} }
/*
inline glm::uint64 loopBitfieldInterleave(glm::uint32 x, glm::uint32 y) inline glm::uint64 loopBitfieldInterleave(glm::uint32 x, glm::uint32 y)
{ {
static glm::uint64 const Mask[5] = static glm::uint64 const Mask[5] =
@ -340,7 +340,7 @@ namespace bitfieldInterleave
return REG1 | (REG2 << 1); return REG1 | (REG2 << 1);
} }
*/
#if(GLM_ARCH != GLM_ARCH_PURE) #if(GLM_ARCH != GLM_ARCH_PURE)
inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y)
{ {
@ -467,11 +467,11 @@ namespace bitfieldInterleave
{ {
glm::uint64 A = glm::bitfieldInterleave(x, y); glm::uint64 A = glm::bitfieldInterleave(x, y);
glm::uint64 B = fastBitfieldInterleave(x, y); glm::uint64 B = fastBitfieldInterleave(x, y);
glm::uint64 C = loopBitfieldInterleave(x, y); //glm::uint64 C = loopBitfieldInterleave(x, y);
glm::uint64 D = interleaveBitfieldInterleave(x, y); glm::uint64 D = interleaveBitfieldInterleave(x, y);
assert(A == B); assert(A == B);
assert(A == C); //assert(A == C);
assert(A == D); assert(A == D);
# if GLM_ARCH & GLM_ARCH_SSE2_BIT # if GLM_ARCH & GLM_ARCH_SSE2_BIT
@ -540,7 +540,7 @@ namespace bitfieldInterleave
std::printf("fastBitfieldInterleave Time %d clocks\n", static_cast<unsigned int>(Time)); std::printf("fastBitfieldInterleave Time %d clocks\n", static_cast<unsigned int>(Time));
} }
/*
{ {
std::clock_t LastTime = std::clock(); std::clock_t LastTime = std::clock();
@ -551,7 +551,7 @@ namespace bitfieldInterleave
std::printf("loopBitfieldInterleave Time %d clocks\n", static_cast<unsigned int>(Time)); std::printf("loopBitfieldInterleave Time %d clocks\n", static_cast<unsigned int>(Time));
} }
*/
{ {
std::clock_t LastTime = std::clock(); std::clock_t LastTime = std::clock();

Loading…
Cancel
Save