Skip to content

Commit

Permalink
Fix bugs in the signed right shift operation.
Browse files Browse the repository at this point in the history
Fixes #664.
  • Loading branch information
Brian Huffman committed Nov 27, 2019
1 parent c859570 commit 56f2638
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Cryptol/Prims/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 56f2638

Please sign in to comment.