#include "HsVersions.h"
import CoreSyn
-import Id ( mkWildId, idUnfolding )
+import MkCore ( mkWildCase )
+import Id ( idUnfolding )
import Literal ( Literal(..), mkMachInt, mkMachWord
, literalType
, word2IntLit, int2WordLit
import Outputable
import FastString
import StaticFlags ( opt_SimplExcessPrecision )
+import Constants
+
import Data.Bits as Bits
import Data.Word ( Word )
\end{code}
rule_fn _ = Nothing
do_lit_eq lit expr
- = Just (Case expr (mkWildId (literalType lit)) boolTy
+ = Just (mkWildCase expr (literalType lit) boolTy
[(DEFAULT, [], val_if_neq),
(LitAlt lit, [], val_if_eq)])
val_if_eq | is_eq = trueVal
-- runtime either, and compilation of completely harmless things like
-- ((124076834 :: Word32) + (2147483647 :: Word32))
-- would yield a warning. Instead we simply squash the value into the
--- Int range, but not in a way suitable for cross-compiling... :-(
+-- *target* Int/Word range.
intResult :: Integer -> Maybe CoreExpr
intResult result
- = Just (mkIntVal (toInteger (fromInteger result :: Int)))
+ = Just (mkIntVal (toInteger (fromInteger result :: TargetInt)))
wordResult :: Integer -> Maybe CoreExpr
wordResult result
- = Just (mkWordVal (toInteger (fromInteger result :: Word)))
+ = Just (mkWordVal (toInteger (fromInteger result :: TargetWord)))
\end{code}