Clean up white spaces, fix build with VC15

master
Christophe Riccio ago%!(EXTRA string=11 years)
parent 6eb5529395
commit 5960196ce8
  1. 2
      glm/gtc/vec1.hpp
  2. 170
      test/core/core_func_integer_bit_count.cpp
  3. 1
      test/core/core_type_vec1.cpp
  4. 2
      test/core/core_type_vec2.cpp
  5. 1
      test/core/core_type_vec3.cpp
  6. 9
      test/core/core_type_vec4.cpp
  7. 2
      test/gtc/gtc_quaternion.cpp
  8. 6
      test/gtc/gtc_random.cpp
  9. 2
      test/gtx/gtx_dual_quaternion.cpp

@ -74,7 +74,7 @@ namespace glm
/// 1 component vector of low precision floating-point numbers. /// 1 component vector of low precision floating-point numbers.
/// There is no guarantee on the actual precision. /// There is no guarantee on the actual precision.
/// @see gtc_vec1 extension. /// @see gtc_vec1 extension.
typedef lowp_dvec1_t lowp_dvec1; typedef lowp_dvec1_t lowp_dvec1;
/// 1 component vector of high precision signed integer numbers. /// 1 component vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision. /// There is no guarantee on the actual precision.

@ -5,9 +5,10 @@
#include <stdlib.h> //To define "exit", req'd by XLC. #include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime> #include <ctime>
unsigned rotatel(unsigned x, int n) { unsigned rotatel(unsigned x, int n)
if ((unsigned)n > 63) {printf("rotatel, n out of range.\n"); exit(1);} {
return (x << n) | (x >> (32 - n)); if ((unsigned)n > 63) {printf("rotatel, n out of range.\n"); exit(1);}
return (x << n) | (x >> (32 - n));
} }
int pop0(unsigned x) int pop0(unsigned x)
@ -20,45 +21,49 @@ int pop0(unsigned x)
return x; return x;
} }
int pop1(unsigned x) { int pop1(unsigned x)
x = x - ((x >> 1) & 0x55555555); {
x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = x - ((x >> 1) & 0x55555555);
x = (x + (x >> 4)) & 0x0F0F0F0F; x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = x + (x >> 8); x = (x + (x >> 4)) & 0x0F0F0F0F;
x = x + (x >> 16); x = x + (x >> 8);
return x & 0x0000003F; x = x + (x >> 16);
return x & 0x0000003F;
} }
/* Note: an alternative to the last three executable lines above is: /* Note: an alternative to the last three executable lines above is:
return x*0x01010101 >> 24; return x*0x01010101 >> 24;
if your machine has a fast multiplier (suggested by Jari Kirma). */ if your machine has a fast multiplier (suggested by Jari Kirma). */
int pop2(unsigned x) { int pop2(unsigned x)
unsigned n; {
unsigned n;
n = (x >> 1) & 033333333333; // Count bits in
x = x - n; // each 3-bit n = (x >> 1) & 033333333333; // Count bits in
n = (n >> 1) & 033333333333; // field. x = x - n; // each 3-bit
x = x - n; n = (n >> 1) & 033333333333; // field.
x = (x + (x >> 3)) & 030707070707; // 6-bit sums. x = x - n;
return x%63; // Add 6-bit sums. x = (x + (x >> 3)) & 030707070707; // 6-bit sums.
return x%63; // Add 6-bit sums.
} }
/* An alternative to the "return" statement above is: /* An alternative to the "return" statement above is:
return ((x * 0404040404) >> 26) + // Add 6-bit sums. return ((x * 0404040404) >> 26) + // Add 6-bit sums.
(x >> 30); (x >> 30);
which runs faster on most machines (suggested by Norbert Juffa). */ which runs faster on most machines (suggested by Norbert Juffa). */
int pop3(unsigned x) { int pop3(unsigned x)
unsigned n; {
unsigned n;
n = (x >> 1) & 0x77777777; // Count bits in
x = x - n; // each 4-bit n = (x >> 1) & 0x77777777; // Count bits in
n = (n >> 1) & 0x77777777; // field. x = x - n; // each 4-bit
x = x - n; n = (n >> 1) & 0x77777777; // field.
n = (n >> 1) & 0x77777777; x = x - n;
x = x - n; n = (n >> 1) & 0x77777777;
x = (x + (x >> 4)) & 0x0F0F0F0F; // Get byte sums. x = x - n;
x = x*0x01010101; // Add the bytes. x = (x + (x >> 4)) & 0x0F0F0F0F; // Get byte sums.
return x >> 24; x = x*0x01010101; // Add the bytes.
return x >> 24;
} }
int pop4(unsigned x) int pop4(unsigned x)
@ -101,67 +106,72 @@ int pop5a(unsigned x)
return sum; return sum;
} }
int pop6(unsigned x) { // Table lookup. int pop6(unsigned x)
static char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 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8}; 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
return table[x & 0xFF] +
table[(x >> 8) & 0xFF] + return table[x & 0xFF] +
table[(x >> 16) & 0xFF] + table[(x >> 8) & 0xFF] +
table[(x >> 24)]; table[(x >> 16) & 0xFF] +
table[(x >> 24)];
} }
// The following works only for 8-bit quantities. // The following works only for 8-bit quantities.
int pop7(unsigned x) { int pop7(unsigned x)
x = x*0x08040201; // Make 4 copies. {
x = x >> 3; // So next step hits proper bits. x = x*0x08040201; // Make 4 copies.
x = x & 0x11111111; // Every 4th bit. x = x >> 3; // So next step hits proper bits.
x = x*0x11111111; // Sum the digits (each 0 or 1). x = x & 0x11111111; // Every 4th bit.
x = x >> 28; // Position the result. x = x*0x11111111; // Sum the digits (each 0 or 1).
return x; x = x >> 28; // Position the result.
return x;
} }
// The following works only for 7-bit quantities. // The following works only for 7-bit quantities.
int pop8(unsigned x) { int pop8(unsigned x)
x = x*0x02040810; // Make 4 copies, left-adjusted. {
x = x & 0x11111111; // Every 4th bit. x = x*0x02040810; // Make 4 copies, left-adjusted.
x = x*0x11111111; // Sum the digits (each 0 or 1). x = x & 0x11111111; // Every 4th bit.
x = x >> 28; // Position the result. x = x*0x11111111; // Sum the digits (each 0 or 1).
return x; x = x >> 28; // Position the result.
return x;
} }
// The following works only for 15-bit quantities. // The following works only for 15-bit quantities.
int pop9(unsigned x) { int pop9(unsigned x)
unsigned long long y; {
y = x * 0x0002000400080010ULL; unsigned long long y;
y = y & 0x1111111111111111ULL; y = x * 0x0002000400080010ULL;
y = y * 0x1111111111111111ULL; y = y & 0x1111111111111111ULL;
y = y >> 60; y = y * 0x1111111111111111ULL;
return y; y = y >> 60;
return y;
} }
int errors; int errors;
void error(int x, int y) { void error(int x, int y)
errors = errors + 1; {
printf("Error for x = %08x, got %08x\n", x, y); errors = errors + 1;
printf("Error for x = %08x, got %08x\n", x, y);
} }
int main() int main()

@ -52,7 +52,6 @@ int test_vec1_ctor()
Error += std::is_trivially_copyable<glm::ivec1>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::ivec1>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::vec1>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1; Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
#endif #endif

@ -11,6 +11,7 @@
#include <glm/vector_relational.hpp> #include <glm/vector_relational.hpp>
#include <glm/vec2.hpp> #include <glm/vec2.hpp>
#include <vector> #include <vector>
#include <type_traits>
int test_vec2_operators() int test_vec2_operators()
{ {
@ -209,7 +210,6 @@ int test_vec2_ctor()
Error += std::is_trivially_copyable<glm::ivec2>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::ivec2>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::uvec2>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::uvec2>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::vec2>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::vec2>::value ? 0 : 1; Error += std::is_copy_constructible<glm::vec2>::value ? 0 : 1;
#endif #endif

@ -28,7 +28,6 @@ int test_vec3_ctor()
Error += std::is_trivially_copyable<glm::ivec3>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::ivec3>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::uvec3>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::uvec3>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::vec3>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::vec3>::value ? 0 : 1; Error += std::is_copy_constructible<glm::vec3>::value ? 0 : 1;
#endif #endif

@ -43,9 +43,11 @@ int test_vec4_ctor()
{ {
int Error = 0; int Error = 0;
glm::ivec4 A(1, 2, 3, 4); {
glm::ivec4 B(A); glm::ivec4 A(1, 2, 3, 4);
Error += glm::all(glm::equal(A, B)) ? 0 : 1; glm::ivec4 B(A);
Error += glm::all(glm::equal(A, B)) ? 0 : 1;
}
#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12) #if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
// Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1; // Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
@ -55,7 +57,6 @@ int test_vec4_ctor()
Error += std::is_trivially_copyable<glm::ivec4>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::ivec4>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::vec4>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1; Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
#endif #endif

@ -281,8 +281,6 @@ int test_quat_ctr()
Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::quat>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::dquat>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1; Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1; Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
#endif #endif

@ -194,10 +194,10 @@ int test_linearRand()
for(std::size_t i = 0; i < 100000; ++i) for(std::size_t i = 0; i < 100000; ++i)
{ {
glm::f32vec2 const A(glm::linearRand(glm::f32vec2(Min), glm::f32vec2(Max))); glm::f32vec2 const A(glm::linearRand(glm::f32vec2(static_cast<float>(Min)), glm::f32vec2(static_cast<float>(Max))));
if(!glm::all(glm::lessThanEqual(A, glm::f32vec2(Max)))) if(!glm::all(glm::lessThanEqual(A, glm::f32vec2(static_cast<float>(Max)))))
++Error; ++Error;
if(!glm::all(glm::greaterThanEqual(A, glm::f32vec2(Min)))) if(!glm::all(glm::greaterThanEqual(A, glm::f32vec2(static_cast<float>(Min)))))
++Error; ++Error;
glm::f64vec2 const B(glm::linearRand(glm::f64vec2(Min), glm::f64vec2(Max))); glm::f64vec2 const B(glm::linearRand(glm::f64vec2(Min), glm::f64vec2(Max)));

@ -174,8 +174,6 @@ int test_dual_quat_ctr()
Error += std::is_trivially_copyable<glm::dualquat>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::dualquat>::value ? 0 : 1;
Error += std::is_trivially_copyable<glm::ddualquat>::value ? 0 : 1; Error += std::is_trivially_copyable<glm::ddualquat>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::dualquat>::value ? 0 : 1;
Error += std::has_trivial_copy_constructor<glm::ddualquat>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::dualquat>::value ? 0 : 1; Error += std::is_copy_constructible<glm::dualquat>::value ? 0 : 1;
Error += std::is_copy_constructible<glm::ddualquat>::value ? 0 : 1; Error += std::is_copy_constructible<glm::ddualquat>::value ? 0 : 1;
#endif #endif

Loading…
Cancel
Save