summaryrefslogtreecommitdiff
path: root/compiler/utils/Encoding.hs
diff options
context:
space:
mode:
authorYuri de Wit <admin@rodlogic.net>2014-11-25 18:22:34 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2014-11-25 18:27:33 +0100
commit4af5748b4589cb5a3c8fc389cc721ebb33260a56 (patch)
treeda34ce887bfe8550607801cb9351594279e3cdb7 /compiler/utils/Encoding.hs
parent5fa018655305a8d9272daf187dd241dee3b606fc (diff)
downloadhaskell-4af5748b4589cb5a3c8fc389cc721ebb33260a56.tar.gz
Replace `STRICT[12345]` macros by `BangPatterns`
This removes the macros `STRICT1()`, `STRICT2()`, `STRICT3()`, `STRICT4()`, and `STRICT5()` CPP macros from `HsVersions.hs` and replaces the few use sites by uses of `BangPatterns`. Reviewed By: hvr Differential Revision: https://phabricator.haskell.org/D525
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