Removed useless if statement

This commit is contained in:
wiire-a 2017-12-01 14:46:41 +01:00
parent 8c6e943bec
commit 3cd589c641
2 changed files with 4 additions and 10 deletions

View File

@ -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];
}

View File

@ -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];
}