diff --git a/src/random.h b/src/random.h index 8618f77ff7b4ad30533be16da7d04e6f15720999..b54da03abc519f2a1f447f75ed109012a7e5ac44 100644 --- a/src/random.h +++ b/src/random.h @@ -107,7 +107,7 @@ INLINE static double inl_erand48(uint16_t xsubi[3]) { temp.ieee.negative = 0; temp.ieee.exponent = IEEE754_DOUBLE_BIAS; temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12); - temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4); + temp.ieee.mantissa1 = (((uint32_t)xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4); /* Please note the lower 4 bits of mantissa1 are always 0. */ return temp.d - 1.0;