Lines Matching refs:state
91 …sizeof(((php_random_status_state_mt19937*)0)->state) / sizeof(((php_random_status_state_mt19937*)0…
103 static inline void mt19937_reload(php_random_status_state_mt19937 *state) in mt19937_reload() argument
105 uint32_t *p = state->state; in mt19937_reload()
107 if (state->mode == MT_RAND_MT19937) { in mt19937_reload()
114 *p = twist(p[M-N], p[0], state->state[0]); in mt19937_reload()
122 *p = twist_php(p[M-N], p[0], state->state[0]); in mt19937_reload()
125 state->count = 0; in mt19937_reload()
128 PHPAPI inline void php_random_mt19937_seed32(php_random_status_state_mt19937 *state, uint32_t seed) in php_random_mt19937_seed32() argument
136 state->state[0] = seed; in php_random_mt19937_seed32()
138 prev_state = state->state[i - 1]; in php_random_mt19937_seed32()
139 state->state[i] = (1812433253U * (prev_state ^ (prev_state >> 30)) + i) & 0xffffffffU; in php_random_mt19937_seed32()
141 state->count = i; in php_random_mt19937_seed32()
143 mt19937_reload(state); in php_random_mt19937_seed32()
146 static php_random_result generate(void *state) in generate() argument
148 php_random_status_state_mt19937 *s = state; in generate()
155 s1 = s->state[s->count++]; in generate()
166 static zend_long range(void *state, zend_long min, zend_long max) in range() argument
170 .state = state, in range()
174 static bool serialize(void *state, HashTable *data) in serialize() argument
176 php_random_status_state_mt19937 *s = state; in serialize()
180 ZVAL_STR(&t, php_random_bin2hex_le(&s->state[i], sizeof(uint32_t))); in serialize()
191 static bool unserialize(void *state, HashTable *data) in unserialize() argument
193 php_random_status_state_mt19937 *s = state; in unserialize()
206 if (!php_random_hex2bin_le(Z_STR_P(t), &s->state[i])) { in unserialize()
240 PHPAPI void php_random_mt19937_seed_default(php_random_status_state_mt19937 *state) in php_random_mt19937_seed_default() argument
248 php_random_mt19937_seed32(state, seed); in php_random_mt19937_seed_default()
256 php_random_status_state_mt19937 *state = engine.state; in PHP_METHOD() local
268 state->mode = MT_RAND_MT19937; in PHP_METHOD()
272 state->mode = MT_RAND_PHP; in PHP_METHOD()
287 php_random_mt19937_seed32(state, seed); in PHP_METHOD()
299 php_random_result generated = engine.algo->generate(engine.state); in PHP_METHOD()
333 if (!engine->engine.algo->serialize(engine->engine.state, Z_ARRVAL(t))) { in PHP_METHOD()
376 if (!engine->engine.algo->unserialize(engine->engine.state, Z_ARRVAL_P(t))) { in PHP_METHOD()
395 if (!engine->engine.algo->serialize(engine->engine.state, Z_ARRVAL(t))) { in PHP_METHOD()