| 10 | |
| 11 | template <typename K, typename T, int N> |
| 12 | int 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 | |
| 24 | constexpr int kMaxK = 16; |
| 25 |
no test coverage detected