rightArithShift

x >> y

rightArithShift(x, y)

Try it yourself:


rightArithShift(): Signed Bit Shift Right

rightArithShift() shifts integer bits right while preserving the sign bit. It approximates division by powers of two for signed integer values, with behavior determined by integer representation.

Signed behavior

This differs from rightLogShift(), which fills left positions with zeros. Use leftShift() for the opposite direction and bitAnd() to inspect flags.

Use integer operands and nonnegative shift counts. Negative values and large shifts should be tested against the platform’s bit-width rules rather than assumed from decimal arithmetic.

All functions