Various coding shift rules

1. The original code
left: high removed, end up 0. When shifting out non-zero, overflow occurs.
Shift right: fill in high position with 0, and shift out low position. Perform rounding when shifting out.
2. Complement
left: high removed, end up 0. When the shifted out bit is different from the sign bit, an overflow occurs.
Right shift: high complement, low shift out. Rounding out operation
3. inverted
left: high removed, end up character. When the shifted out bit is different from the sign bit, an overflow occurs.
Right shift: high complement, low shift out. Rounding when shifting out

Guess you like

Origin blog.csdn.net/qq1350975694/article/details/107228441