@@ -34,11 +34,11 @@ import Control.Exception (assert)
35import Control.Monad.ST (ST, runST)
35import Control.Monad.ST (ST, runST)
36import Data.Bits ((.&.))
36import Data.Bits ((.&.))
37−import Data.Char (ord)
38import Data.Monoid (Monoid(..))
37import Data.Monoid (Monoid(..))
39import Data.Text.Internal (Text(..))
38import Data.Text.Internal (Text(..))
40import Data.Text.Lazy.Internal (smallChunkSize)
39import Data.Text.Lazy.Internal (smallChunkSize)
41import Data.Text.Unsafe (inlineInterleaveST)
40import Data.Text.Unsafe (inlineInterleaveST)
41+import Data.Text.UnsafeChar (ord, unsafeWrite)
42import Data.Text.UnsafeShift (shiftR)
42import Data.Text.UnsafeShift (shiftR)
43import Prelude hiding (map, putChar)
43import Prelude hiding (map, putChar)
@@ -258,29 +258,6 @@ newBuffer size = do
258 return $! Buffer arr 0 0 size
258 return $! Buffer arr 0 0 size
259{-# INLINE newBuffer #-}
259{-# INLINE newBuffer #-}
261−-- Write a character to the array, starting at the specified offset
262−-- @i@. Returns the number of elements written.
263−unsafeWrite :: A.MArray s -> Int -> Char -> ST s Int
267− assert (i >= 0) . assert (i < A.length marr) $ return ()
269− A.unsafeWrite marr i (fromIntegral n)
273− assert (i >= 0) . assert (i < A.length marr - 1) $ return ()
275− A.unsafeWrite marr i lo
276− A.unsafeWrite marr (i+1) hi
280− lo = fromIntegral $ (m `shiftR` 10) + 0xD800
281− hi = fromIntegral $ (m .&. 0x3FF) + 0xDC00
282−{-# INLINE unsafeWrite #-}
284------------------------------------------------------------------------
261------------------------------------------------------------------------
285-- Some nice rules for Builder
262-- Some nice rules for Builder