Fix bugs in the signed right shift operation.

Fixes #664.
This commit is contained in:
Brian Huffman 2019-11-26 22:23:00 -08:00
parent c859570234
commit 56f263895a

View File

@ -678,9 +678,8 @@ sshrV =
wlam $ \y ->
let signx = testBit x (fromInteger (i-1))
amt = fromInteger (bvVal y)
negv = (((-1) `shiftL` amt) .|. x) `shiftR` amt
posv = x `shiftR` amt
in return . VWord i . ready . WordVal . mkBv i $! if signx then negv else posv
x' = if signx then x - bit (fromInteger i) else x
in return . VWord i . ready . WordVal . mkBv i $! x' `shiftR` amt
-- | Signed carry bit.
scarryV :: Value