Optimize symbolic "extract" to produce literal value if result has width 0

This commit is contained in:
Brian Huffman 2014-07-21 11:28:40 -07:00
parent 733c7932c5
commit 010d930638

View File

@ -106,6 +106,7 @@ instance SDivisible (SBV BitVector) where
extract :: Int -> Int -> SWord -> SWord
extract i j x =
case x of
_ | i < j -> SBV k (Left (CW k (CWInteger 0)))
SBV _ (Left cw) ->
case cw of
CW _ (CWInteger v) -> SBV k (Left (normCW (CW k (CWInteger (v `shiftR` j)))))