blob: 5546fff08ba5a186b56ff67140f0f2456344cf01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include "sfc64.h"
extern void sfc64_set_seed(sfc64_state *state, uint64_t *seed) {
/* Conservatively stick with the original formula. With SeedSequence, it
* might be fine to just set the state with 4 uint64s and be done.
*/
int i;
state->s[0] = seed[0];
state->s[1] = seed[1];
state->s[2] = seed[2];
state->s[3] = 1;
for (i=0; i<12; i++) {
(void)sfc64_next(state->s);
}
}
extern void sfc64_get_state(sfc64_state *state, uint64_t *state_arr, int *has_uint32,
uint32_t *uinteger) {
int i;
for (i=0; i<4; i++) {
state_arr[i] = state->s[i];
}
has_uint32[0] = state->has_uint32;
uinteger[0] = state->uinteger;
}
extern void sfc64_set_state(sfc64_state *state, uint64_t *state_arr, int has_uint32,
uint32_t uinteger) {
int i;
for (i=0; i<4; i++) {
state->s[i] = state_arr[i];
}
state->has_uint32 = has_uint32;
state->uinteger = uinteger;
}
|