| 94 | } |
| 95 | |
| 96 | uint64_t ngram_mixed(const int64_t* ctx, const uint64_t* mult, int n) { |
| 97 | // The first term is an ASSIGNMENT and the rest are XORed into it, which is how the source writes it |
| 98 | // (`uint64_t mixed = ctx[0]*m[0]; for j=1.. mixed ^= ctx[j]*m[j];`). Every product wraps mod 2^64, |
| 99 | // which is what the `(uint64_t)` casts in the source make explicit. |
| 100 | uint64_t mixed = (uint64_t) ctx[0] * mult[0]; |
| 101 | for (int j = 1; j < n; ++j) mixed ^= (uint64_t) ctx[j] * mult[j]; |
| 102 | return mixed; |
| 103 | } |
| 104 | |
| 105 | void ngram_rows(const int32_t* tokens, const int32_t* prev, int n_tokens, const PleConsts& c, uint32_t* out) { |
| 106 | const int n_prev = NGRAM_SIZE - 1; |
no outgoing calls
no test coverage detected