Native least-prime collision searches #
The search scans the prime bitmap in increasing order. A candidate runs the complete native
three-set collision query. Its first acceptance is retained while the remaining candidates
are visited without further bitmap reads. If no candidate is accepted, the answer is one, matching
ChanHe.minOrOne.
Main definitions #
Search.program: a fixed native prime search using charged collision queries.
Main results #
Search.exec: exact minimum/default selection with native fits, frames and charged cost.Search.preserves_caller: the upper five caller registers are preserved.
Largest candidate prime.
Prime bitmap base.
Factor multiplied by the candidate prime.
Current candidate.
One past the largest candidate.
Selected prime, or the default one.
Whether an acceptance has already occurred.
Constant one.
Constant zero.
Constant two, for positive signed encoding.
Unencoded candidate modulus.
Bitmap address scratch.
Loaded primality bit.
Encoded candidate modulus.
Acceptance flag returned by the collision query.
Compute and encode the candidate modulus, then run the full collision query.
Record an accepted candidate, or retain the previous answer.
A charged instruction that retains the answer.
Load a bitmap entry.
Before the first acceptance, run the query exactly on prime candidates.
One candidate and its charged cursor increment.
Initialize the selector and scan the entire bounded candidate range.
The five upper caller registers survive the complete native search.
The least prime whose three actual collision counts satisfy the supplied thresholds.
Every candidate query is executed by Query.program; the hypotheses only constrain native
input values, layout and word fits. All instructions, including the scan after acceptance,
are charged. The final halt is excluded.