tags:

views:

43

answers:

1

In MIPS, is there a way to shift a binary number (0000) by filling its MSB with 1 (1000 and next time 1100 and next time 1110 so on...) each time?

+2  A: 

If the sign bit is set, the Arithmetic Shift Right will shift in 1's on the left (for sign-extension presumably)

sra Shift right arithmetic by a constant number of bits

srav Shift right arithmetic by a variable number of bits

"sra and srav behave like sll and sllv but shift right instead of left. The sign bit is shifted in from the most significant end, and bits fall off the least significant end. "

http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/bitshift.html

Joe Koberg