Arithmetic right shift (source code)

= Arithmetic right shift
{title2=$\operatorname{ASR}_k(a)=\lfloor a/2^k\rfloor$}

An <arithmetic right shift> propagates the sign <bit> into the vacated high positions. For a signed <two's complement> <integer>, its result is division by $2^k$ rounded down. This differs from <C integer division> on negative nonmultiples of $2^k$, because that quotient truncates towards zero. Shifting an $n$-<bit> word arithmetically by $n-1$ produces zero for a nonnegative value and the all-one word, representing $-1$, for a negative value.