elektryk napisał: Logiczne i arytmetyczne w prawo działają tak samo (wsuwają z prawej zero, a bit z lewej idzie w kosmos). Logiczne w lewo wsuwa z lewej bit zerowy, a skrajny prawy bit leci w kosmos. Arytmetyczne w lewsu z lewej wsuwa kopie najstarszago bitu, a z bit prawy leci w kosmos.
Odwrotnie. Arytmetyczne w prawo sluzy do dzielenia signed numbers, a logiczne w prawo unsigned.
Logiczne i arytmetyczne w lewo dzialaja tak samo.
Oto cytat z dobrej ksiazki:
SAL Shift Arithmetic Left - This instruction is just a synonym for SHL. It
is assembled into the exactly the same machine code as SHL. As long
as the sign bit is not changed by the shift, the result will be correct.
SAR Shift Arithmetic Right - This is a new instruction that does not shift
the sign bit (i.e. the msb) of its operand. The other bits are shifted
as normal except that the new bits that enter from the left are copies
of the sign bit (that is, if the sign bit is 1, the new bits are also 1).
Thus, if a byte is shifted with this instruction, only the lower 7 bits
are shifted. As for the other shifts, the last bit shifted out is stored in
the carry flag.