simplify $bits on simple part selects

This commit is contained in:
Zachary Snow
2020-06-06 21:28:37 -04:00
parent eb93ba67fc
commit 2d7982f81e
3 changed files with 34 additions and 0 deletions
+7
View File
@@ -136,4 +136,11 @@ convertBits (Right e) =
Nothing -> Number "32"
Just 0 -> Number "32"
Just idx -> Number $ take idx n
Range expr mode range ->
BinOp Mul size $ convertBits $ Right $ Bit expr (Number "0")
where
size = case mode of
NonIndexed -> rangeSize range
IndexedPlus -> snd range
IndexedMinus -> snd range
_ -> DimsFn FnBits $ Left $ TypeOf e