on master help sign in
Rename partialCopy to copy

--HG-- extra : convert_revision : 29a04b59902b1abb5bfc76ca6b369151cad731bb

commitb4755699c866d79db38aeb2e2b96b0766ac71c7c authorBryan O'Sullivan <bos@serpentine.com> dateSun 29 Aug 2010, 05:54 (16 years ago) parent00722f1
5 files changed+24−24
Data/Text.hs+4−4 Data/Text/Array.hs+16−16 Data/Text/Fusion.hs+2−2 Data/Text/Lazy/Builder.hs+1−1 Data/Text/Lazy/Fusion.hs+1−1
Data/Text.hs+4−4
@@ -298,8 +298,8 @@ append (Text arr1 off1 len1) (Text arr2 off2 len2) = Text (A.run x) 0 len
298298 len = len1+len2
299299 x = do
300300 arr <- A.unsafeNew len
301− A.partialCopyI arr 0 arr1 off1 len1
302− A.partialCopyI arr len1 arr2 off2 (len1+len2)
301+ A.copyI arr 0 arr1 off1 len1
302+ A.copyI arr len1 arr2 off2 (len1+len2)
303303 return arr
304304{-# INLINE append #-}
305305
@@ -660,7 +660,7 @@ concat ts = case ts' of
660660 go = do
661661 arr <- A.unsafeNew len
662662 let step i (Text a o l) =
663− let !j = i + l in A.partialCopyI arr i a o j >> return j
663+ let !j = i + l in A.copyI arr i a o j >> return j
664664 foldM step 0 ts' >> return arr
665665
666666-- | /O(n)/ Map a function over a 'Text' that results in a 'Text', and
@@ -769,7 +769,7 @@ replicate n t@(Text a o l)
769769 arr <- A.unsafeNew len
770770 let loop !d !i | i >= n = return arr
771771 | otherwise = let m = d + l
772− in A.partialCopyI arr d a o m >> loop m (i+1)
772+ in A.copyI arr d a o m >> loop m (i+1)
773773 loop 0 0
774774{-# INLINE [1] replicate #-}
775775
Data/Text/Array.hs+16−16
@@ -30,8 +30,8 @@ module Data.Text.Array
3030 , MArray
3131
3232 -- * Functions
33− , partialCopyM
34− , partialCopyI
33+ , copyM
34+ , copyI
3535 , empty
3636 , run
3737 , run2
@@ -205,13 +205,13 @@ wordAligned :: Int -> Bool
205205wordAligned i = i .&. (wordFactor - 1) == 0
206206
207207-- | Copy some elements of a mutable array.
208−partialCopyM :: MArray s -- ^ Destination
209− -> Int -- ^ Destination offset
210− -> MArray s -- ^ Source
211− -> Int -- ^ Source offset
212− -> Int -- ^ Count
213− -> ST s ()
214−partialCopyM dest didx src sidx count =
208+copyM :: MArray s -- ^ Destination
209+ -> Int -- ^ Destination offset
210+ -> MArray s -- ^ Source
211+ -> Int -- ^ Source offset
212+ -> Int -- ^ Count
213+ -> ST s ()
214+copyM dest didx src sidx count =
215215#if defined(ASSERTS)
216216 assert (sidx + count <= length src) .
217217 assert (didx + count <= length dest) $
@@ -234,14 +234,14 @@ partialCopyM dest didx src sidx count =
234234 slow_loop (i+1)
235235
236236-- | Copy some elements of an immutable array.
237−partialCopyI :: MArray s -- ^ Destination
238− -> Int -- ^ Destination offset
239− -> Array -- ^ Source
240− -> Int -- ^ Source offset
241− -> Int -- ^ First offset in source /not/ to
237+copyI :: MArray s -- ^ Destination
238+ -> Int -- ^ Destination offset
239+ -> Array -- ^ Source
240+ -> Int -- ^ Source offset
241+ -> Int -- ^ First offset in source /not/ to
242242 -- copy (i.e. /not/ length)
243− -> ST s ()
244−partialCopyI dest i0 src j0 top
243+ -> ST s ()
244+copyI dest i0 src j0 top
245245 | wordAligned i0 && wordAligned j0 = fast (i0 `div` wordFactor) (j0 `div` wordFactor)
246246 | otherwise = slow i0 j0
247247 where
Data/Text/Fusion.hs+2−2
@@ -105,7 +105,7 @@ unstream (Stream next0 s0 len) = I.textP (P.fst a) 0 (P.snd a)
105105 | j >= top -> {-# SCC "unstream/resize" #-} do
106106 let top' = (top + 1) `shiftL` 1
107107 arr' <- A.unsafeNew top'
108− A.partialCopyM arr' 0 arr 0 top
108+ A.copyM arr' 0 arr 0 top
109109 outer arr' top' s i
110110 | otherwise -> do d <- unsafeWrite arr i x
111111 loop s' (i+d)
@@ -138,7 +138,7 @@ reverse (Stream next s len0)
138138 Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
139139 let newLen = len `shiftL` 1
140140 marr' <- A.unsafeNew newLen
141− A.partialCopyM marr' (newLen-len) marr 0 len
141+ A.copyM marr' (newLen-len) marr 0 len
142142 write s1 (len+i) newLen marr'
143143 | otherwise -> write s1 i len marr
144144 where n = ord x
Data/Text/Lazy/Builder.hs+1−1
@@ -122,7 +122,7 @@ copyLimit = 128
122122fromText :: S.Text -> Builder
123123fromText t@(Text arr off l)
124124 | S.null t = empty
125− | l <= copyLimit = writeN l $ \marr o -> A.partialCopyI marr o arr off (l+o)
125+ | l <= copyLimit = writeN l $ \marr o -> A.copyI marr o arr off (l+o)
126126 | otherwise = flush `append` mapBuilder (t :)
127127{-# INLINE [1] fromText #-}
128128
Data/Text/Lazy/Fusion.hs+1−1
@@ -67,7 +67,7 @@ unstreamChunks chunkSize (Stream next s0 len0)
6767 | i + 1 >= len = do
6868 let newLen = min (len `shiftL` 1) chunkSize
6969 marr' <- A.unsafeNew newLen
70− A.partialCopyM marr' 0 marr 0 len
70+ A.copyM marr' 0 marr 0 len
7171 inner marr' newLen s i
7272 | otherwise =
7373 case next s of