bit.shraΒΆ
x[:n] >>= times (arithmetic shift right)
times is a constant.
@Assumes: times <= n
@Assumes: times <= n
SignatureΒΆ
def shra n, times, x { ... }
Defined in bit/shifts.fj β lines 24β27 (view on GitHub).
ComplexityΒΆ
Time:
n(2@-1)Space:
n(2@-1)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def shra n, times, x {
rep(n-times, i) .mov x+i*dw, x+(i+times)*dw
rep(times-1, i) .mov x+(n-1-(i+1))*dw, x+(n-1)*dw
}