X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FLiteral.lhs;fp=ghc%2Fcompiler%2FbasicTypes%2FLiteral.lhs;h=2167ba025753d81722ca7957bfe6c21973156489;hb=fcfe16433bd582d0e00404ea652806d13d14103c;hp=7df6fca9bdfe9129aff7dd76ad9f291452029433;hpb=f682290809d7641e3f8ec188eec9109193189ba1;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/Literal.lhs b/ghc/compiler/basicTypes/Literal.lhs index 7df6fca..2167ba0 100644 --- a/ghc/compiler/basicTypes/Literal.lhs +++ b/ghc/compiler/basicTypes/Literal.lhs @@ -13,6 +13,7 @@ module Literal , hashLiteral , inIntRange, inWordRange, tARGET_MAX_INT, inCharRange + , isZeroLit, , word2IntLit, int2WordLit , narrow8IntLit, narrow16IntLit, narrow32IntLit @@ -163,6 +164,15 @@ inWordRange x = x >= 0 && x <= tARGET_MAX_WORD inCharRange :: Int -> Bool inCharRange c = c >= 0 && c <= tARGET_MAX_CHAR + +isZeroLit :: Literal -> Bool +isZeroLit (MachInt 0) = True +isZeroLit (MachInt64 0) = True +isZeroLit (MachWord 0) = True +isZeroLit (MachWord64 0) = True +isZeroLit (MachFloat 0) = True +isZeroLit (MachDouble 0) = True +isZeroLit other = False \end{code} Coercions