compute pf(ss) using standard Horner method */
| 63 | |
| 64 | /* compute pf(ss) using standard Horner method */ |
| 65 | void horner1(unsigned long *pf, mt19937_state *state) { |
| 66 | int i = MEXP - 1; |
| 67 | mt19937_state *temp; |
| 68 | |
| 69 | temp = (mt19937_state *)calloc(1, sizeof(mt19937_state)); |
| 70 | |
| 71 | while (get_coef(pf, i) == 0) |
| 72 | i--; |
| 73 | |
| 74 | if (i > 0) { |
| 75 | copy_state(temp, state); |
| 76 | gen_next(temp); |
| 77 | i--; |
| 78 | for (; i > 0; i--) { |
| 79 | if (get_coef(pf, i) != 0) |
| 80 | add_state(temp, state); |
| 81 | else |
| 82 | ; |
| 83 | gen_next(temp); |
| 84 | } |
| 85 | if (get_coef(pf, 0) != 0) |
| 86 | add_state(temp, state); |
| 87 | else |
| 88 | ; |
| 89 | } else if (i == 0) |
| 90 | copy_state(temp, state); |
| 91 | else |
| 92 | ; |
| 93 | |
| 94 | copy_state(state, temp); |
| 95 | free(temp); |
| 96 | } |
| 97 | |
| 98 | void mt19937_jump_state(mt19937_state *state) { |
| 99 | unsigned long *pf; |
no test coverage detected