Address /W4 compiler warnings for Windows (#4910)

This commit is contained in:
Zach H 2023-10-15 20:31:13 -04:00 committed by GitHub
parent cb90a8356b
commit 186f4289e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 279 additions and 272 deletions

View file

@ -44,11 +44,13 @@ unsigned int RNG_SFMT::rand(int min, int max)
return max;
// This is actually not used in Cockatrice:
// Someone wants rand() % -foo, so we compute -rand(0, +foo)
// This is the only time where min > max is (sort of) legal.
// Someone wants rand() % -foo, so we should compute -rand(0, +foo)
// But this method returns an unsigned int, so it doesn't really make
// a difference.
// This is the only time when min > max is (sort of) legal.
// Not handling this will cause the application to crash.
if (min == 0 && max < 0) {
return -cdf(0, -max);
return cdf(0, -max);
}
// No special cases are left, except !(min > max) which is caught in the cdf itself.