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

Function gather

engine/src/quant/dispatch.cpp:12–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11template <typename K, typename T, int N>
12int gather(const T (&tables)[N], Type t, Arith a, const K** out, int cap, Type K::*field) {
13 int n = 0;
14 for (const T& tb : tables)
15 for (int i = 0; i < tb.n; ++i) {
16 const K& k = tb.v[i];
17 if (k.*field == t && k.arith == a && n < cap) out[n++] = &k;
18 }
19 // best (widest hardware) first
20 std::stable_sort(out, out + n, [](const K* x, const K* y) { return (int) x->isa > (int) y->isa; });
21 return n;
22}
23
24constexpr int kMaxK = 16;
25

Callers 2

collect_dotsFunction · 0.70
collect_actsFunction · 0.70

Calls 1

stable_sortFunction · 0.85

Tested by

no test coverage detected