diff options
author | Josh Meredith <joshmeredith2008@gmail.com> | 2023-04-20 08:44:58 +0000 |
---|---|---|
committer | Josh Meredith <joshmeredith2008@gmail.com> | 2023-05-15 12:14:23 +0000 |
commit | 52a9b94df71dece6a18864e8255bf0ad7a838498 (patch) | |
tree | 5cbfb929a659d67178f21f69a1f5ae60e1fdcb29 /libraries/base/GHC/IO/Encoding/CodePage/API.hs | |
parent | e45a825fc0d9672e2fbb606e138478c0baa40004 (diff) | |
download | haskell-wip/unboxed-codebuffer.tar.gz |
Use unboxed codebuffers in basewip/unboxed-codebuffer
Metric Decrease:
encodingAllocations
Diffstat (limited to 'libraries/base/GHC/IO/Encoding/CodePage/API.hs')
-rw-r--r-- | libraries/base/GHC/IO/Encoding/CodePage/API.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libraries/base/GHC/IO/Encoding/CodePage/API.hs b/libraries/base/GHC/IO/Encoding/CodePage/API.hs index 6136156cdb..e8412e8356 100644 --- a/libraries/base/GHC/IO/Encoding/CodePage/API.hs +++ b/libraries/base/GHC/IO/Encoding/CodePage/API.hs @@ -1,6 +1,7 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE CPP, NoImplicitPrelude, NondecreasingIndentation, - RecordWildCards, ScopedTypeVariables #-} + RecordWildCards, ScopedTypeVariables, + UnboxedTuples #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} module GHC.IO.Encoding.CodePage.API ( @@ -157,11 +158,15 @@ newCP rec fn cp = do utf16_native_encode' :: EncodeBuffer utf16_native_decode' :: DecodeBuffer #if defined(WORDS_BIGENDIAN) -utf16_native_encode' = utf16be_encode -utf16_native_decode' = utf16be_decode +utf16_native_encode' i o = IO $ \st -> case utf16be_encode i o st of + (# st', c, i', o' #) -> (# st', (c, i', o') #) +utf16_native_decode' i o = IO $ \st -> case utf16be_decode i o st of + (# st', c, i', o' #) -> (# st', (c, i', o') #) #else -utf16_native_encode' = utf16le_encode -utf16_native_decode' = utf16le_decode +utf16_native_encode' i o = IO $ \st -> case utf16le_encode i o st of + (# st', c, i', o' #) -> (# st', (c, i', o') #) +utf16_native_decode' i o = IO $ \st -> case utf16le_decode i o st of + (# st', c, i', o' #) -> (# st', (c, i', o') #) #endif saner :: CodeBuffer from to |