on master help sign in
Drop restreamUtf8 function that is no longer used (gh-44)
commit6cbbdd6f8db9fd05327d1d9b01184bdff6f6cfe4 authorBryan O'Sullivan <bos@serpentine.com> dateSun 21 Apr 2013, 10:53 (13 years ago) parent77e9113
1 file changed+1−27
Data/Text/Encoding/Fusion/Common.hs+1−27
Data/Text/Encoding/Fusion/Common.hs+1−27
@@ -21,8 +21,7 @@ module Data.Text.Encoding.Fusion.Common
2121 -- * Restreaming
2222 -- Restreaming is the act of converting from one 'Stream'
2323 -- representation to another.
24− restreamUtf8
25− , restreamUtf16LE
24+ restreamUtf16LE
2625 , restreamUtf16BE
2726 , restreamUtf32LE
2827 , restreamUtf32BE
@@ -34,31 +33,6 @@ import Data.Text.Fusion.Internal (RS(..))
3433import Data.Text.UnsafeChar (ord)
3534import Data.Text.UnsafeShift (shiftR)
3635import Data.Word (Word8)
37−import qualified Data.Text.Encoding.Utf8 as U8
38−
39−-- | /O(n)/ Convert a Stream Char into a UTF-8 encoded Stream Word8.
40−restreamUtf8 :: Stream Char -> Stream Word8
41−restreamUtf8 (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2)
42− where
43− next (RS0 s) = case next0 s of
44− Done -> Done
45− Skip s' -> Skip (RS0 s')
46− Yield x s'
47− | n <= 0x7F -> Yield c (RS0 s')
48− | n <= 0x07FF -> Yield a2 (RS1 s' b2)
49− | n <= 0xFFFF -> Yield a3 (RS2 s' b3 c3)
50− | otherwise -> Yield a4 (RS3 s' b4 c4 d4)
51− where
52− n = ord x
53− c = fromIntegral n
54− (a2,b2) = U8.ord2 x
55− (a3,b3,c3) = U8.ord3 x
56− (a4,b4,c4,d4) = U8.ord4 x
57− next (RS1 s x2) = Yield x2 (RS0 s)
58− next (RS2 s x2 x3) = Yield x2 (RS1 s x3)
59− next (RS3 s x2 x3 x4) = Yield x2 (RS2 s x3 x4)
60− {-# INLINE next #-}
61−{-# INLINE restreamUtf8 #-}
6236
6337restreamUtf16BE :: Stream Char -> Stream Word8
6438restreamUtf16BE (Stream next0 s0 len) = Stream next (RS0 s0) (len * 2)