Fix sign-compare warnings

This commit is contained in:
Tom Kneiphof 2024-03-07 17:48:46 +01:00 committed by Christophe
parent c48d16b911
commit 08a11905cf
5 changed files with 41 additions and 41 deletions

View File

@ -231,7 +231,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'mask' accepts only integer values");
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
return Bits >= static_cast<genIUType>(sizeof(genIUType) * 8) ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
}
#if GLM_COMPILER & GLM_COMPILER_CLANG

View File

@ -208,7 +208,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop0(test[i]) != test[i+1]) error(test[i], pop0(test[i]));}
if (pop0(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop0(test[i]));}
TimestampEnd = std::clock();
std::printf("pop0: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -216,7 +216,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop1(test[i]) != test[i+1]) error(test[i], pop1(test[i]));}
if (pop1(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop1(test[i]));}
TimestampEnd = std::clock();
std::printf("pop1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -224,7 +224,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop2(test[i]) != test[i+1]) error(test[i], pop2(test[i]));}
if (pop2(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop2(test[i]));}
TimestampEnd = std::clock();
std::printf("pop2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -232,7 +232,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop3(test[i]) != test[i+1]) error(test[i], pop3(test[i]));}
if (pop3(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop3(test[i]));}
TimestampEnd = std::clock();
std::printf("pop3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -240,7 +240,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop4(test[i]) != test[i+1]) error(test[i], pop4(test[i]));}
if (pop4(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop4(test[i]));}
TimestampEnd = std::clock();
std::printf("pop4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -248,7 +248,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop5(test[i]) != test[i+1]) error(test[i], pop5(test[i]));}
if (pop5(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop5(test[i]));}
TimestampEnd = std::clock();
std::printf("pop5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -256,7 +256,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop5a(test[i]) != test[i+1]) error(test[i], pop5a(test[i]));}
if (pop5a(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop5a(test[i]));}
TimestampEnd = std::clock();
std::printf("pop5a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -264,7 +264,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (pop6(test[i]) != test[i+1]) error(test[i], pop6(test[i]));}
if (pop6(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop6(test[i]));}
TimestampEnd = std::clock();
std::printf("pop6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -273,7 +273,7 @@ int main()
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if ((test[i] & 0xffffff00) == 0)
if (pop7(test[i]) != test[i+1]) error(test[i], pop7(test[i]));}
if (pop7(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop7(test[i]));}
TimestampEnd = std::clock();
std::printf("pop7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -282,7 +282,7 @@ int main()
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if ((test[i] & 0xffffff80) == 0)
if (pop8(test[i]) != test[i+1]) error(test[i], pop8(test[i]));}
if (pop8(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop8(test[i]));}
TimestampEnd = std::clock();
std::printf("pop8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -291,7 +291,7 @@ int main()
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if ((test[i] & 0xffff8000) == 0)
if (pop9(test[i]) != test[i+1]) error(test[i], pop9(test[i]));}
if (pop9(test[i]) != static_cast<int>(test[i+1])) error(test[i], pop9(test[i]));}
TimestampEnd = std::clock();
std::printf("pop9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));

View File

@ -312,7 +312,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz1(test[i]) != test[i+1]) error(test[i], ntz1(test[i]));}
if (ntz1(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz1(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -320,7 +320,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz2(test[i]) != test[i+1]) error(test[i], ntz2(test[i]));}
if (ntz2(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz2(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -328,7 +328,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz3(test[i]) != test[i+1]) error(test[i], ntz3(test[i]));}
if (ntz3(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz3(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -336,7 +336,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz4(test[i]) != test[i+1]) error(test[i], ntz4(test[i]));}
if (ntz4(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz4(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -344,7 +344,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz4a(test[i]) != test[i+1]) error(test[i], ntz4a(test[i]));}
if (ntz4a(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz4a(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz4a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -366,7 +366,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz6(test[i]) != test[i+1]) error(test[i], ntz6(test[i]));}
if (ntz6(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz6(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -374,7 +374,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz6a(test[i]) != test[i+1]) error(test[i], ntz6a(test[i]));}
if (ntz6a(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz6a(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz6a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -382,7 +382,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz7(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
if (ntz7(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -390,7 +390,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz7_christophe(test[i]) != test[i+1]) error(test[i], ntz7(test[i]));}
if (ntz7_christophe(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz7(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz7_christophe: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -398,7 +398,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz8(test[i]) != test[i+1]) error(test[i], ntz8(test[i]));}
if (ntz8(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz8(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -406,7 +406,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz8a(test[i]) != test[i+1]) error(test[i], ntz8a(test[i]));}
if (ntz8a(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz8a(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz8a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -414,7 +414,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz9(test[i]) != test[i+1]) error(test[i], ntz9(test[i]));}
if (ntz9(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz9(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -422,7 +422,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz10(test[i]) != test[i+1]) error(test[i], ntz10(test[i]));}
if (ntz10(test[i]) != static_cast<int>(test[i+1])) error(test[i], ntz10(test[i]));}
TimestampEnd = std::clock();
std::printf("ntz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -430,7 +430,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (ntz11(test[i]) != test[i + 1]) error(test[i], ntz11(test[i]));
if (ntz11(test[i]) != static_cast<int>(test[i + 1])) error(test[i], ntz11(test[i]));
}
TimestampEnd = std::clock();

View File

@ -338,7 +338,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz1(test[i]) != test[i+1]) error(test[i], nlz1(test[i]));}
if (nlz1(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz1(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz1: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -346,7 +346,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz1a(test[i]) != test[i+1]) error(test[i], nlz1a(test[i]));}
if (nlz1a(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz1a(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz1a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -354,7 +354,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz2(test[i]) != test[i+1]) error(test[i], nlz2(test[i]));}
if (nlz2(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz2(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz2: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -362,7 +362,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz2a(test[i]) != test[i+1]) error(test[i], nlz2a(test[i]));}
if (nlz2a(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz2a(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz2a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -370,7 +370,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz3(test[i]) != test[i+1]) error(test[i], nlz3(test[i]));}
if (nlz3(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz3(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz3: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -378,7 +378,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz4(test[i]) != test[i+1]) error(test[i], nlz4(test[i]));}
if (nlz4(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz4(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz4: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -386,7 +386,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz5(test[i]) != test[i+1]) error(test[i], nlz5(test[i]));}
if (nlz5(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz5(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz5: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -394,7 +394,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz6(test[i]) != test[i+1]) error(test[i], nlz6(test[i]));}
if (nlz6(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz6(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz6: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -402,7 +402,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz7(test[i]) != test[i+1]) error(test[i], nlz7(test[i]));}
if (nlz7(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz7(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -410,7 +410,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz8(test[i]) != test[i+1]) error(test[i], nlz8(test[i]));}
if (nlz8(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz8(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz8: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -418,7 +418,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz9(test[i]) != test[i+1]) error(test[i], nlz9(test[i]));}
if (nlz9(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz9(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz9: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -426,7 +426,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz10(test[i]) != test[i+1]) error(test[i], nlz10(test[i]));}
if (nlz10(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz10(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz10: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -434,7 +434,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz10a(test[i]) != test[i+1]) error(test[i], nlz10a(test[i]));}
if (nlz10a(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz10a(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz10a: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
@ -442,7 +442,7 @@ int main()
TimestampBeg = std::clock();
for (std::size_t k = 0; k < Count; ++k)
for (i = 0; i < n; i += 2) {
if (nlz10b(test[i]) != test[i+1]) error(test[i], nlz10b(test[i]));}
if (nlz10b(test[i]) != static_cast<int>(test[i + 1])) error(test[i], nlz10b(test[i]));}
TimestampEnd = std::clock();
std::printf("nlz10b: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));

View File

@ -34,7 +34,7 @@ namespace mask
static inline int mask_mix(int Bits)
{
return Bits >= sizeof(int) * 8 ? 0xffffffff : (static_cast<int>(1) << Bits) - static_cast<int>(1);
return Bits >= static_cast<int>(sizeof(int) * 8) ? 0xffffffff : (static_cast<int>(1) << Bits) - static_cast<int>(1);
}
#if GLM_COMPILER & GLM_COMPILER_CLANG