hex.swap (arity 3)ΒΆ
Unsafe if dst and src overlap! but safe if they are the exact same address.
hex1[:n], hex2[:n] = hex2[:n], hex1[:n]
SignatureΒΆ
def swap n, hex1, hex2 @ end { ... }
Defined in hex/memory.fj β lines 115β121 (view on GitHub).
ComplexityΒΆ
Time:
n(3@)Space:
n(3@+36)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def swap n, hex1, hex2 @ end {
stl.comp_if1 hex1==hex2, end
.xor n, hex1, hex2
.xor n, hex2, hex1
.xor n, hex1, hex2
end:
}
Depends onΒΆ
β Previous: hex.swap/2