SHL won't do 32 bits
Red_Dog
Posts: 7
I'm trying to write a shift routine to shift two 32 bit registers to perform a 64 bit shift.
When the shift count is <= 32 I'm doing the following:
Mov temp, #32
Sub temp, count
Mov high_temp, high_long
Shl high_temp, temp
Shr low_long, count
Add low_long, high_temp
Shr high_long, count
The problem I'm having is when temp is 32, shl doesn't shift at all.
If I make temp #31, it works, but not #32. If make
Temp t#33, it shifts it as if temp is #1.
The manual doesn't say anything about limitations for the number of
Bits that can be shifted, although it wouldn't make sense to shift it
More than 32.
What am I missing?
When the shift count is <= 32 I'm doing the following:
Mov temp, #32
Sub temp, count
Mov high_temp, high_long
Shl high_temp, temp
Shr low_long, count
Add low_long, high_temp
Shr high_long, count
The problem I'm having is when temp is 32, shl doesn't shift at all.
If I make temp #31, it works, but not #32. If make
Temp t#33, it shifts it as if temp is #1.
The manual doesn't say anything about limitations for the number of
Bits that can be shifted, although it wouldn't make sense to shift it
More than 32.
What am I missing?
Comments
-Phil
A thought: code the shift using rotates, since a 32 bit and a 0 bit rotate are the same thing anyway.
-Phil
-Phil