Commits

Bryan O'Sullivan committed 197e4b5

Rename partialCopy to copy

Comments (0)

Files changed (5)

       len = len1+len2
       x = do
         arr <- A.unsafeNew len
-        A.partialCopyI arr 0 arr1 off1 len1
-        A.partialCopyI arr len1 arr2 off2 (len1+len2)
+        A.copyI arr 0 arr1 off1 len1
+        A.copyI arr len1 arr2 off2 (len1+len2)
         return arr
 {-# INLINE append #-}
 
     go = do
       arr <- A.unsafeNew len
       let step i (Text a o l) =
-            let !j = i + l in A.partialCopyI arr i a o j >> return j
+            let !j = i + l in A.copyI arr i a o j >> return j
       foldM step 0 ts' >> return arr
 
 -- | /O(n)/ Map a function over a 'Text' that results in a 'Text', and
       arr <- A.unsafeNew len
       let loop !d !i | i >= n    = return arr
                      | otherwise = let m = d + l
-                                   in A.partialCopyI arr d a o m >> loop m (i+1)
+                                   in A.copyI arr d a o m >> loop m (i+1)
       loop 0 0
 {-# INLINE [1] replicate #-}
 

Data/Text/Array.hs

     , MArray
 
     -- * Functions
-    , partialCopyM
-    , partialCopyI
+    , copyM
+    , copyI
     , empty
     , run
     , run2
 wordAligned i = i .&. (wordFactor - 1) == 0
 
 -- | Copy some elements of a mutable array.
-partialCopyM :: MArray s        -- ^ Destination
-             -> Int             -- ^ Destination offset
-             -> MArray s        -- ^ Source
-             -> Int             -- ^ Source offset
-             -> Int             -- ^ Count
-             -> ST s ()
-partialCopyM dest didx src sidx count =
+copyM :: MArray s               -- ^ Destination
+      -> Int                    -- ^ Destination offset
+      -> MArray s               -- ^ Source
+      -> Int                    -- ^ Source offset
+      -> Int                    -- ^ Count
+      -> ST s ()
+copyM dest didx src sidx count =
 #if defined(ASSERTS)
     assert (sidx + count <= length src) .
     assert (didx + count <= length dest) $
                            slow_loop (i+1)
 
 -- | Copy some elements of an immutable array.
-partialCopyI :: MArray s        -- ^ Destination
-             -> Int             -- ^ Destination offset
-             -> Array           -- ^ Source
-             -> Int             -- ^ Source offset
-             -> Int             -- ^ First offset in source /not/ to
+copyI :: MArray s               -- ^ Destination
+      -> Int                    -- ^ Destination offset
+      -> Array                  -- ^ Source
+      -> Int                    -- ^ Source offset
+      -> Int                    -- ^ First offset in source /not/ to
                                 -- copy (i.e. /not/ length)
-             -> ST s ()
-partialCopyI dest i0 src j0 top
+      -> ST s ()
+copyI dest i0 src j0 top
     | wordAligned i0 && wordAligned j0 = fast (i0 `div` wordFactor) (j0 `div` wordFactor)
     | otherwise = slow i0 j0
   where

Data/Text/Fusion.hs

                 | j >= top  -> {-# SCC "unstream/resize" #-} do
                                let top' = (top + 1) `shiftL` 1
                                arr' <- A.unsafeNew top'
-                               A.partialCopyM arr' 0 arr 0 top
+                               A.copyM arr' 0 arr 0 top
                                outer arr' top' s i
                 | otherwise -> do d <- unsafeWrite arr i x
                                   loop s' (i+d)
           Yield x s1 | i < least -> {-# SCC "reverse/resize" #-} do
                        let newLen = len `shiftL` 1
                        marr' <- A.unsafeNew newLen
-                       A.partialCopyM marr' (newLen-len) marr 0 len
+                       A.copyM marr' (newLen-len) marr 0 len
                        write s1 (len+i) newLen marr'
                      | otherwise -> write s1 i len marr
             where n = ord x

Data/Text/Lazy/Builder.hs

 fromText :: S.Text -> Builder
 fromText t@(Text arr off l)
     | S.null t       = empty
-    | l <= copyLimit = writeN l $ \marr o -> A.partialCopyI marr o arr off (l+o)
+    | l <= copyLimit = writeN l $ \marr o -> A.copyI marr o arr off (l+o)
     | otherwise      = flush `append` mapBuilder (t :)
 {-# INLINE [1] fromText #-}
 

Data/Text/Lazy/Fusion.hs

         | i + 1 >= len       = do
             let newLen = min (len `shiftL` 1) chunkSize
             marr' <- A.unsafeNew newLen
-            A.partialCopyM marr' 0 marr 0 len
+            A.copyM marr' 0 marr 0 len
             inner marr' newLen s i
         | otherwise =
             case next s of