Original | Shift Left Two |
---|---|
0110 1111 | 1011 1100 |
0x6F | 0xBC |
If the original 8-bit pattern represented an integer, then shifting left by two positions is probably a mistake because a significant bit has been lost.
This program does the shift you just performed. It does it with 32-bit patterns, but for the right-most eight bits the result is the same.
## shiftTwo.asm ## ## Program to logical shift left a pattern .text .globl main main: ori $8, $0, 0x6F # put bit pattern into register $8 sll $9, $8, 2 # shift left logical by two ## End of file
Running the program does the following. Since this time the shift was done with 32 bits, the high order one-bit was not lost.