Merge pull request #25 from kbinani/remove-long

Fix nextInt for `sizeof(long) != 8` compilers
This commit is contained in:
Cubitect 2020-04-22 22:15:10 +02:00 committed by GitHub
commit e3d56411da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ static inline int nextInt(int64_t *seed, const int n)
int bits, val;
const int m = n - 1;
if((m & n) == 0) return (int) ((n * (long)next(seed, 31)) >> 31);
if((m & n) == 0) return (int) ((n * (int64_t)next(seed, 31)) >> 31);
do {
bits = next(seed, 31);