1
#include "philox.h"
2

3
extern NPY_INLINE uint64_t philox_next64(philox_state *state);
4

5
extern NPY_INLINE uint32_t philox_next32(philox_state *state);
6

7 0
extern void philox_jump(philox_state *state) {
8
  /* Advances state as-if 2^128 draws were made */
9 0
  state->ctr->v[2]++;
10 0
  if (state->ctr->v[2] == 0) {
11 0
    state->ctr->v[3]++;
12
  }
13
}
14

15 1
extern void philox_advance(uint64_t *step, philox_state *state) {
16 1
  int i, carry = 0;
17
  uint64_t v_orig;
18 1
  for (i = 0; i < 4; i++) {
19 1
    if (carry == 1) {
20 0
      state->ctr->v[i]++;
21 0
      carry = state->ctr->v[i] == 0 ? 1 : 0;
22
    }
23 1
    v_orig = state->ctr->v[i];
24 1
    state->ctr->v[i] += step[i];
25 1
    if (state->ctr->v[i] < v_orig && carry == 0) {
26 0
      carry = 1;
27
    }
28
  }
29
}

Read our documentation on viewing source code .

Loading