cast P_Random(Key/Range) PRNG calls to INT64 to preserve old behavior

(it's still technically "undefined" behavior anyway)
This commit is contained in:
Inuyasha 2016-05-11 13:54:40 -07:00
parent a529dca69f
commit fbce35d27e
1 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ INT32 P_RandomKeyD(const char *rfile, INT32 rline, INT32 a)
{
CONS_Printf("P_RandomKey() at: %sp %d\n", rfile, rline);
#endif
return (INT32)((__internal_prng__() * a) >> FRACBITS);
return (INT32)(((INT64)__internal_prng__() * a) >> FRACBITS);
}
/** Provides a random integer in a given range.
@ -171,7 +171,7 @@ INT32 P_RandomRangeD(const char *rfile, INT32 rline, INT32 a, INT32 b)
{
CONS_Printf("P_RandomRange() at: %sp %d\n", rfile, rline);
#endif
return (INT32)((__internal_prng__() * (b-a+1)) >> FRACBITS) + a;
return (INT32)(((INT64)__internal_prng__() * (b-a+1)) >> FRACBITS) + a;
}