mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-15 03:40:56 +01:00
asr simply return the word if the shift is 0
This commit is contained in:
parent
c6a1db4f6c
commit
e64b17aea4
1 changed files with 1 additions and 1 deletions
|
@ -103,7 +103,7 @@ class CPU
|
||||||
# Arithmetic shift right
|
# Arithmetic shift right
|
||||||
def asr(word : Word, bits : Int, set_conditions : Bool) : Word
|
def asr(word : Word, bits : Int, set_conditions : Bool) : Word
|
||||||
log "asr - word:#{hex_str word}, bits:#{bits}"
|
log "asr - word:#{hex_str word}, bits:#{bits}"
|
||||||
bits = 32 if bits == 0
|
return word if bits == 0
|
||||||
@cpsr.carry = bit?(word, bits - 1) if set_conditions
|
@cpsr.carry = bit?(word, bits - 1) if set_conditions
|
||||||
word >> bits | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits)
|
word >> bits | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue