From 3cd589c6417caea1441432d8fa9f0e746f739665 Mon Sep 17 00:00:00 2001 From: wiire-a Date: Fri, 1 Dec 2017 14:46:41 +0100 Subject: [PATCH] Removed useless if statement --- src/random/glibc_random.c | 7 ++----- src/random/glibc_random_lazy.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/random/glibc_random.c b/src/random/glibc_random.c index 739860c..be2f2f2 100644 --- a/src/random/glibc_random.c +++ b/src/random/glibc_random.c @@ -52,11 +52,8 @@ static void glibc_seed(struct glibc_prng *prng, uint32_t seed) uint32_t *state = prng->state; prng->index = 344; state[i++] = seed; - for ( ; i < 31; i++) { - state[i] = (16807LL * state[i - 1]) % 2147483647; - if (state[i] & 0x80000000) /* < 0 */ - state[i] += 2147483647; - } + for ( ; i < 31; i++) + state[i] = (16807LL * state[i - 1]) % 0x7fffffff; for (i = 31; i < 34; i++) state[i] = state[i - 31]; for (i = 34; i < 344; i++) state[i] = state[i - 31] + state[i - 3]; } diff --git a/src/random/glibc_random_lazy.c b/src/random/glibc_random_lazy.c index 055ff1a..a9891da 100644 --- a/src/random/glibc_random_lazy.c +++ b/src/random/glibc_random_lazy.c @@ -51,11 +51,8 @@ static void glibc_lazyseed(struct glibc_lazyprng *prng, uint32_t seed) uint32_t *state = prng->state; uint32_t i = 0; state[i++] = seed; - for ( ; i < 31; i++) { - state[i] = (16807LL * state[i - 1]) % 2147483647; - if (state[i] & 0x80000000) /* < 0 */ - state[i] += 2147483647; - } + for ( ; i < 31; i++) + state[i] = (16807LL * state[i - 1]) % 0x7fffffff; for (i = 31; i < 34; i++) state[i] = state[i - 31]; for (i = 34; i < 344 - 3 + 1; i++) state[i] = state[i - 31] + state[i - 3]; }