Signed Integers: assume D0 = -12345678
|
D1 = D0 >> 5
|
D1 = -12345678 >> 5
1111_1111_0100_0011_1001_1110_1011_0010 - initial bit pattern
1111_1111_1010_0001_1100_1111_0101_1001 - after 1st right shift
1111_1111_1101_0000_1110_0111_1010_1100 - after 2nd right shift
1111_1111_1110_1000_0111_0011_1101_0110 - after 3rd right shift
1111_1111_1111_0100_0011_1001_1110_1011 - after 4th right shift
1111_1111_1111_1010_0001_1100_1111_0101 - after 5th right shift
D1 = -385803
|
One operand is an unsigned integer memory locations, the other is an
integer constant.
The lower 5 bits are shifted out. The remaining 11 bits are shifted
into the lowest 11 bit positions. The upper 5 positions are filled with
1's. The sign bit of the original value will be maintained.
The result is placed in an unsigned integer memory location.
|
N1 = N0 >> 5
|
N1 = -12345 >> 5
1111_1111_1111_1111_1100_1111_1100_0111
- initial bit pattern
1111_1111_1111_1111_1110_0111_1110_0011
- after 1st right shift
1111_1111_1111_1111_1111_0011_1111_0001
- after 2nd right shift
1111_1111_1111_1111_1111_1001_1111_1000
- after 3rd right shift
1111_1111_1111_1111_1111_1100_1111_1100
- after 4th right shift
1111_1111_1111_1111_1111_1110_0111_1110
- after 5th right shift
N1 = -386
|
One operand is an unsigned integer memory locations, the other is an
integer constant.
The 16-bit integer is sign-extended to 32-bits when it is loaded into
the math stack.
The lower 5 bits are shifted out. The remaining 11 bits are shifted
into the lowest 11 bit positions. The upper 5 positions are filled with
1's. The sign bit of the original value will be maintained.
The result is placed in an unsigned integer memory location.
|