From e64b17aea4c0769282f02e515c8653d276b6b8cc Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Sun, 18 Oct 2020 11:38:56 -0700 Subject: [PATCH] asr simply return the word if the shift is 0 --- src/crab/cpu.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crab/cpu.cr b/src/crab/cpu.cr index cec0b27..19e2491 100644 --- a/src/crab/cpu.cr +++ b/src/crab/cpu.cr @@ -103,7 +103,7 @@ class CPU # Arithmetic shift right def asr(word : Word, bits : Int, set_conditions : Bool) : Word 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 word >> bits | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits) end