Two-child node search #
Below the large-width fusion threshold, the tree branches in two. Direct comparison of the two child minima supplies a uniform constant-time fallback. The eighteen-word header and interleaved key/pointer table use the same layout as larger nodes.
Main definitions #
BinaryNodeProgram.registers,BinaryNodeProgram.query,BinaryNodeProgram.pointer,BinaryNodeProgram.out,BinaryNodeProgram.two,BinaryNodeProgram.offset,BinaryNodeProgram.address,BinaryNodeProgram.first,BinaryNodeProgram.second: register allocation for the two-child node search.BinaryNodeProgram.code: actual two-child node search.BinaryNodeProgram.rank,BinaryNodeProgram.result: the inclusive rank among two keys and the resulting machine data.
Main results #
BinaryNodeProgram.exec: execution in at most eleven standard instructions.BinaryNodeProgram.rank_eq: the computed value is the inclusive full-key rank.
References #
The register interface agrees with the larger fusion-node query.
Bounded query, preserved.
Record base, preserved.
Final inclusive rank, zero, one, or two.
Distance between the two child minima.
Offset of the child table.
Address scratch.
First child minimum.
Second child minimum.
Two direct full-key comparisons, with charged constants and memory loads.
The inclusive rank among two increasing full keys.
Exact data after reading both minima and returning their rank.
Eleven instructions suffice for the binary fallback. All address and constant bounds follow from the address of the second key; all memory, query, and record base are preserved. Only registers two through seven change.