Corrected the display of variables relating to REM
This commit is contained in:
parent
a14a866502
commit
183e68ee59
|
@ -90,7 +90,9 @@ checkArrayUsage tree = (mapM_ checkPar $ listify (const True) tree) >> return tr
|
||||||
showFlattenedExp (Modulo top bottom)
|
showFlattenedExp (Modulo top bottom)
|
||||||
= do top' <- showFlattenedExpSet top
|
= do top' <- showFlattenedExpSet top
|
||||||
bottom' <- showFlattenedExpSet bottom
|
bottom' <- showFlattenedExpSet bottom
|
||||||
return $ "(" ++ top' ++ " REM " ++ bottom' ++ ")"
|
case onlyConst (Set.toList bottom) of
|
||||||
|
Just _ -> return $ "(" ++ top' ++ " / " ++ bottom' ++ ")"
|
||||||
|
Nothing -> return $ "((" ++ top' ++ " REM " ++ bottom' ++ ") - " ++ top' ++ ")"
|
||||||
showFlattenedExp (Divide top bottom)
|
showFlattenedExp (Divide top bottom)
|
||||||
= do top' <- showFlattenedExpSet top
|
= do top' <- showFlattenedExpSet top
|
||||||
bottom' <- showFlattenedExpSet bottom
|
bottom' <- showFlattenedExpSet bottom
|
||||||
|
@ -127,6 +129,12 @@ customVarCompare :: A.Variable -> A.Variable -> Ordering
|
||||||
customVarCompare (A.Variable _ (A.Name _ _ lname)) (A.Variable _ (A.Name _ _ rname)) = compare lname rname
|
customVarCompare (A.Variable _ (A.Name _ _ lname)) (A.Variable _ (A.Name _ _ rname)) = compare lname rname
|
||||||
-- TODO the rest
|
-- TODO the rest
|
||||||
|
|
||||||
|
onlyConst :: [FlattenedExp] -> Maybe Integer
|
||||||
|
onlyConst [] = Just 0
|
||||||
|
onlyConst ((Const n):es) = liftM2 (+) (return n) $ onlyConst es
|
||||||
|
onlyConst _ = Nothing
|
||||||
|
|
||||||
|
|
||||||
makeExpSet :: [FlattenedExp] -> Either String (Set.Set FlattenedExp)
|
makeExpSet :: [FlattenedExp] -> Either String (Set.Set FlattenedExp)
|
||||||
makeExpSet = foldM makeExpSet' Set.empty
|
makeExpSet = foldM makeExpSet' Set.empty
|
||||||
where
|
where
|
||||||
|
@ -389,11 +397,6 @@ makeEquations es high = makeEquations' >>* (\(s,v,lh) -> [(s,squareEquations eqI
|
||||||
|
|
||||||
makeEquation' m (Divide top bottom) = throwError "TODO Divide"
|
makeEquation' m (Divide top bottom) = throwError "TODO Divide"
|
||||||
|
|
||||||
onlyConst :: [FlattenedExp] -> Maybe Integer
|
|
||||||
onlyConst [] = Just 0
|
|
||||||
onlyConst ((Const n):es) = liftM2 (+) (return n) $ onlyConst es
|
|
||||||
onlyConst _ = Nothing
|
|
||||||
|
|
||||||
empty :: [(Map.Map Int Integer,[Map.Map Int Integer], [Map.Map Int Integer])]
|
empty :: [(Map.Map Int Integer,[Map.Map Int Integer], [Map.Map Int Integer])]
|
||||||
empty = [(Map.empty,[],[])]
|
empty = [(Map.empty,[],[])]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user