X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FbasicTypes%2FLiteral.lhs;h=a5c413ad16ab7a82b29435f2214988f5d5fda7b5;hp=598b5a49170fcb58b6a54046e15c6633444907fb;hb=6758ba711a3f9f3100a9dba1818b131c32e62106;hpb=72b5392f4103dc895d569bfad647ddec2de67dec diff --git a/compiler/basicTypes/Literal.lhs b/compiler/basicTypes/Literal.lhs index 598b5a4..a5c413a 100644 --- a/compiler/basicTypes/Literal.lhs +++ b/compiler/basicTypes/Literal.lhs @@ -16,6 +16,7 @@ module Literal , inIntRange, inWordRange, tARGET_MAX_INT, inCharRange , isZeroLit + , litFitsInChar , word2IntLit, int2WordLit , narrow8IntLit, narrow16IntLit, narrow32IntLit @@ -284,6 +285,12 @@ litIsDupable :: Literal -> Bool litIsDupable (MachStr _) = False litIsDupable other = True +litFitsInChar :: Literal -> Bool +litFitsInChar (MachInt i) + = fromInteger i <= ord minBound + && fromInteger i >= ord maxBound +litFitsInChar _ = False + litSize :: Literal -> Int -- Used by CoreUnfold.sizeExpr litSize (MachStr str) = 1 + ((lengthFS str + 3) `div` 4)