summaryrefslogtreecommitdiff
path: root/compiler/utils/Encoding.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/Encoding.hs')
-rw-r--r--compiler/utils/Encoding.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/utils/Encoding.hs b/compiler/utils/Encoding.hs
index 5c8619baa6..ae727d2f3f 100644
--- a/compiler/utils/Encoding.hs
+++ b/compiler/utils/Encoding.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples #-}
+{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -O #-}
-- We always optimise this, otherwise performance of a non-optimised
-- compiler is severely affected
@@ -28,7 +28,6 @@ module Encoding (
zDecodeString
) where
-#include "HsVersions.h"
import Foreign
import Data.Char
import Numeric
@@ -169,16 +168,14 @@ utf8EncodeChar c ptr =
utf8EncodeString :: Ptr Word8 -> String -> IO ()
utf8EncodeString ptr str = go ptr str
- where STRICT2(go)
- go _ [] = return ()
+ where go !_ [] = return ()
go ptr (c:cs) = do
ptr' <- utf8EncodeChar c ptr
go ptr' cs
utf8EncodedLength :: String -> Int
utf8EncodedLength str = go 0 str
- where STRICT2(go)
- go n [] = n
+ where go !n [] = n
go n (c:cs)
| ord c > 0 && ord c <= 0x007f = go (n+1) cs
| ord c <= 0x07ff = go (n+2) cs