bit.swap (arity 3)ΒΆ
a[:n], b[:n] = b[:n], a[:n]
a,b are bit.vec[:n].
SignatureΒΆ
def swap n, a, b { ... }
Defined in bit/memory.fj β lines 110β112 (view on GitHub).
ComplexityΒΆ
Time:
n(2@+5)Space:
n(3@+8)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def swap n, a, b {
rep(n, i) .swap a+i*dw, b+i*dw
}
β Previous: bit.swap/2