[add support for 30 bit Int's controlled with the -ffull-int flag. fix conversion functions for signed types
John Meacham <john@repetae.net>**20080323012213] hunk ./C/FromGrin2.hs 30
+import Options
hunk ./C/FromGrin2.hs 39
+import qualified FlagOpts as FO
hunk ./C/FromGrin2.hs 76
-    cpr = Set.insert cChar $ Set.fromList [ a | (a,TyTy { tySlots = [s], tySiblings = Just [a'] }) <- Map.assocs tmap, a == a', isJust (good s) ]
+    cpr = iw `Set.union` Set.insert cChar (Set.fromList [ a | (a,TyTy { tySlots = [s], tySiblings = Just [a'] }) <- Map.assocs tmap, a == a', isJust (good s) ])
+    iw = if fopts FO.FullInt then Set.empty else Set.fromList [cInt, cWord]
hunk ./C/FromGrin2.hs 252
+opTyToCh hint opty = basicType (tyToC hint opty)
hunk ./C/FromGrin2.hs 254
-
hunk ./C/FromGrin2.hs 770
-                    c <- fmap toEnum $toIntegral i
+                    c <- toIntegral i
+                    guard $ c >= ord minBound && c <= ord maxBound
+                    c <- return $ chr c
hunk ./C/FromGrin2.hs 804
--- TODO fix
+
+castFunc Op.Lobits _ tb e = cast (opTyToC tb) e
+castFunc Op.U2U _ tb e = cast (opTyToC tb) e
+castFunc Op.Zx _ tb e = cast (opTyToC tb) e
+
+castFunc Op.I2I tf tb e = cast (opTyToCh Op.HintSigned tb) (cast (opTyToCh Op.HintSigned tf) e)
+castFunc Op.Sx tf tb e = cast (opTyToCh Op.HintSigned tb) (cast (opTyToCh Op.HintSigned tf) e)
+
+castFunc Op.F2I tf tb e = cast (opTyToCh Op.HintSigned tb) e
+castFunc Op.I2F tf tb e = cast (opTyToC tb) (cast (opTyToCh Op.HintSigned tf) e)
+
hunk ./FlagOpts.flags 34
+full-int extend Int and Word to 32 bits on a 32 bit machine (rather than 30)
hunk ./Grin/Val.hs 7
+    cWord,
hunk ./Grin/Val.hs 21
-import qualified Cmm.Op as Op
hunk ./Grin/Val.hs 25
+cWord    = convertName dc_Word
hunk ./Grin/Val.hs 81
-    fromVal (NodeC _ [Lit i _]) | Just x <- toIntegral i = return (chr x)
+    fromVal (NodeC _ [Lit i _]) | Just x <- toIntegral i, x >= ord minBound && x <= ord maxBound = return (chr x)
hunk ./Grin/Val.hs 83
-    fromUnVal (Lit i _) | Just x <- toIntegral i = return (chr x)
+    fromUnVal (Lit i _) | Just x <- toIntegral i, x >= ord minBound && x <= ord maxBound = return (chr x)
hunk ./data/rts/jhc_rts2.c 12
-#define VALUE(n)     ((wptr_t)(((uintptr_t)(n) << 2) | P_VALUE))
-#define GETVALUE(n)  ((uintptr_t)(n) >> 2)
+#define VALUE(n)     ((wptr_t)(((intptr_t)(n) << 2) | P_VALUE))
+#define GETVALUE(n)  ((intptr_t)(n) >> 2)