MCPcopy Create free account
hub / github.com/Niko1221/Strata / ngram_mixed

Function ngram_mixed

engine/src/kernels/ngram.cpp:96–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96uint64_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
105void 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;

Callers 3

mainFunction · 0.85
mainFunction · 0.85
ngram_rowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected