From c1f0ff92c97118bc5981f2c90211005008b89718 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 9 Mar 2008 16:26:50 +0000 Subject: [PATCH] Corrected the transformation of AFTER for the BYTE type --- transformations/SimplifyExprs.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/transformations/SimplifyExprs.hs b/transformations/SimplifyExprs.hs index 74946da..83ab749 100644 --- a/transformations/SimplifyExprs.hs +++ b/transformations/SimplifyExprs.hs @@ -108,8 +108,12 @@ removeAfter = doGeneric `extM` doExpression = do a' <- removeAfter a b' <- removeAfter b t <- typeOfExpression a' - let zero = A.Literal m t $ A.IntLiteral m "0" - return $ A.Dyadic m A.More (A.Dyadic m A.Minus a' b') zero + case t of + A.Byte -> do let one = A.Literal m t $ A.IntLiteral m "1" + oneTwoSeven = A.Literal m t $ A.IntLiteral m "127" + return $ A.Dyadic m A.Less (A.Dyadic m A.Minus (A.Dyadic m A.Minus a' b') one) oneTwoSeven + _ -> do let zero = A.Literal m t $ A.IntLiteral m "0" + return $ A.Dyadic m A.More (A.Dyadic m A.Minus a' b') zero doExpression e = doGeneric e -- | For array literals that include other arrays, burst them into their elements.