static void init_mwc32_r(struct state_mwc32_r *state, uint32_t seed) { int i; uint64_t x = seed*Z1 + seed*Z2 + Z3 + Z1; x = (MASK64(x) != 0) ? x : (Z3 + Z2); state->s1 = MASK64(x); for (i=0; i<11; i++) next_mwc32_r(state); }
static void init_mwc32_m2_64(struct state_mwc32_m2_64 *state, uint32_t seed) { int i; uint64_t x = seed*Z3 + seed*Z4 + Z5 + Z3; x = (MASK64(x) != 0) ? x : (Z5 + Z4); state->s1 = MASK64(x); for (i=0; i<11; i++) next_mwc32_m2_64(state); }
static void init_mwc32_m2_32(struct state_mwc32_m2_32 *state, uint32_t seed) { int i; uint64_t x = seed*Z1 + seed*Z2 + Z5 + Z1; x = (MASK64(x) != 0) ? x : (Z5 + Z2); state->s1 = L31(x); state->c = L30(H32(x)); for (i=0; i<11; i++) next_mwc32_m2_32(state); }
MASKED64(unsigned64 word, unsigned start, unsigned stop) { return (word & MASK64(start, stop)); }