fix mrand48/jrand48 return value on 64-bit archs

POSIX specifies the result to have signed 32-bit range. on 32-bit
archs, the implicit conversion to long achieved the desired range
already, but when long is 64-bit, a cast is needed.

patch by Ed Schouten.
This commit is contained in:
Rich Felker 2016-12-16 23:19:27 -05:00
parent bfcf5735d0
commit adfe682eb0

View File

@ -6,7 +6,7 @@ extern unsigned short __seed48[7];
long jrand48(unsigned short s[3])
{
return __rand48_step(s, __seed48+3) >> 16;
return (int32_t)(__rand48_step(s, __seed48+3) >> 16);
}
long mrand48(void)