mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
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:
parent
a529dca69f
commit
fbce35d27e
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue