hex.cmp (arity 6)ΒΆ
Three-way compare on n-nibble hex vectors: jumps to lt if a[:n]<b[:n], eq if equal, gt if a[:n]>b[:n].
SignatureΒΆ
def cmp n, a, b, lt, eq, gt { ... }
Defined in hex/cond_jumps.fj β lines 120β123 (view on GitHub).
ComplexityΒΆ
Time:
m(3@+8) // m=(n-i), where i is the most-significant index such that a[i] != b[i] (if a==b, then m==n).Space:
n(3@+30)
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires initΒΆ
The following must be initialised before this macro is invoked:
hex.cmp.init (or hex.init)
SourceΒΆ
Click to view the macro body
def cmp n, a, b, lt, eq, gt {
rep(n-1, i) .cmp.cmp_eq_next a+(n-1-i)*dw, b+(n-1-i)*dw, lt, gt
.cmp a, b, lt, eq, gt
}
Depends onΒΆ
Used byΒΆ
Example usesΒΆ
β Previous: hex.cmp/5
Next: hex.cmp.cmp_eq_next β