mirror of
https://github.com/composewell/streamly.git
synced 2024-08-16 23:10:36 +03:00
Change array constructor accessor
This commit is contained in:
parent
cc3bbd76dc
commit
799b79fbf9
@ -244,7 +244,7 @@ getIndexRev :: forall a. Unboxed a => Int -> Array a -> Maybe a
|
|||||||
getIndexRev i arr =
|
getIndexRev i arr =
|
||||||
unsafeInlineIO
|
unsafeInlineIO
|
||||||
$ do
|
$ do
|
||||||
let elemPtr = RINDEX_OF(aEnd arr, i, a)
|
let elemPtr = RINDEX_OF(arrEnd arr, i, a)
|
||||||
if i >= 0 && elemPtr >= arrStart arr
|
if i >= 0 && elemPtr >= arrStart arr
|
||||||
then Just <$> peekWith (arrContents arr) elemPtr
|
then Just <$> peekWith (arrContents arr) elemPtr
|
||||||
else return Nothing
|
else return Nothing
|
||||||
@ -410,7 +410,7 @@ getIndex i arr =
|
|||||||
unsafeInlineIO
|
unsafeInlineIO
|
||||||
$ do
|
$ do
|
||||||
let elemPtr = INDEX_OF(arrStart arr, i, a)
|
let elemPtr = INDEX_OF(arrStart arr, i, a)
|
||||||
if i >= 0 && INDEX_VALID(elemPtr, aEnd arr, a)
|
if i >= 0 && INDEX_VALID(elemPtr, arrEnd arr, a)
|
||||||
then Just <$> peekWith (arrContents arr) elemPtr
|
then Just <$> peekWith (arrContents arr) elemPtr
|
||||||
else return Nothing
|
else return Nothing
|
||||||
|
|
||||||
|
@ -346,10 +346,10 @@ data Array a =
|
|||||||
Array
|
Array
|
||||||
{ arrContents :: {-# UNPACK #-} !(ArrayContents a)
|
{ arrContents :: {-# UNPACK #-} !(ArrayContents a)
|
||||||
, arrStart :: {-# UNPACK #-} !Int -- ^ index into arrContents
|
, arrStart :: {-# UNPACK #-} !Int -- ^ index into arrContents
|
||||||
, aEnd :: {-# UNPACK #-} !Int -- ^ index into arrContents
|
, arrEnd :: {-# UNPACK #-} !Int -- ^ index into arrContents
|
||||||
-- Represents the first invalid index of
|
-- Represents the first invalid index of
|
||||||
-- the array.
|
-- the array.
|
||||||
, aBound :: {-# UNPACK #-} !Int -- ^ first invalid index of arrContents.
|
, arrBound :: {-# UNPACK #-} !Int -- ^ first invalid index of arrContents.
|
||||||
}
|
}
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -401,8 +401,8 @@ newArrayWith alloc alignSize count = do
|
|||||||
return $ Array
|
return $ Array
|
||||||
{ arrContents = contents
|
{ arrContents = contents
|
||||||
, arrStart = 0
|
, arrStart = 0
|
||||||
, aEnd = 0
|
, arrEnd = 0
|
||||||
, aBound = size
|
, arrBound = size
|
||||||
}
|
}
|
||||||
|
|
||||||
-- XXX Move this to Unboxed and rename this to newPinnedAlignedBytes?
|
-- XXX Move this to Unboxed and rename this to newPinnedAlignedBytes?
|
||||||
@ -463,8 +463,8 @@ newPinnedArrayBytes bytes = do
|
|||||||
return $ Array
|
return $ Array
|
||||||
{ arrContents = contents
|
{ arrContents = contents
|
||||||
, arrStart = 0
|
, arrStart = 0
|
||||||
, aEnd = 0
|
, arrEnd = 0
|
||||||
, aBound = bytes
|
, arrBound = bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | Allocate an Array of the given size and run an IO action passing the array
|
-- | Allocate an Array of the given size and run an IO action passing the array
|
||||||
@ -492,7 +492,7 @@ putIndexUnsafe :: forall m a. (MonadIO m, Unboxed a)
|
|||||||
=> Int -> a -> Array a -> m ()
|
=> Int -> a -> Array a -> m ()
|
||||||
putIndexUnsafe i x Array{..} = do
|
putIndexUnsafe i x Array{..} = do
|
||||||
let index = INDEX_OF(arrStart, i, a)
|
let index = INDEX_OF(arrStart, i, a)
|
||||||
assert (i >= 0 && INDEX_VALID(index, aEnd, a)) (return ())
|
assert (i >= 0 && INDEX_VALID(index, arrEnd, a)) (return ())
|
||||||
liftIO $ pokeWith arrContents index x
|
liftIO $ pokeWith arrContents index x
|
||||||
|
|
||||||
invalidIndex :: String -> Int -> a
|
invalidIndex :: String -> Int -> a
|
||||||
@ -511,7 +511,7 @@ invalidIndex label i =
|
|||||||
putIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> a -> Array a -> m ()
|
putIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> a -> Array a -> m ()
|
||||||
putIndex i x Array{..} = do
|
putIndex i x Array{..} = do
|
||||||
let index = INDEX_OF(arrStart,i,a)
|
let index = INDEX_OF(arrStart,i,a)
|
||||||
if i >= 0 && INDEX_VALID(index,aEnd,a)
|
if i >= 0 && INDEX_VALID(index,arrEnd,a)
|
||||||
then liftIO $ pokeWith arrContents index x
|
then liftIO $ pokeWith arrContents index x
|
||||||
else invalidIndex "putIndex" i
|
else invalidIndex "putIndex" i
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ modifyIndexUnsafe :: forall m a b. (MonadIO m, Unboxed a) =>
|
|||||||
Int -> (a -> (a, b)) -> Array a -> m b
|
Int -> (a -> (a, b)) -> Array a -> m b
|
||||||
modifyIndexUnsafe i f Array{..} = liftIO $ do
|
modifyIndexUnsafe i f Array{..} = liftIO $ do
|
||||||
let index = INDEX_OF(arrStart,i,a)
|
let index = INDEX_OF(arrStart,i,a)
|
||||||
assert (i >= 0 && INDEX_NEXT(index,a) <= aEnd) (return ())
|
assert (i >= 0 && INDEX_NEXT(index,a) <= arrEnd) (return ())
|
||||||
r <- peekWith arrContents index
|
r <- peekWith arrContents index
|
||||||
let (x, res) = f r
|
let (x, res) = f r
|
||||||
pokeWith arrContents index x
|
pokeWith arrContents index x
|
||||||
@ -548,7 +548,7 @@ modifyIndex :: forall m a b. (MonadIO m, Unboxed a) =>
|
|||||||
Int -> (a -> (a, b)) -> Array a -> m b
|
Int -> (a -> (a, b)) -> Array a -> m b
|
||||||
modifyIndex i f Array{..} = do
|
modifyIndex i f Array{..} = do
|
||||||
let index = INDEX_OF(arrStart,i,a)
|
let index = INDEX_OF(arrStart,i,a)
|
||||||
if i >= 0 && INDEX_VALID(index,aEnd,a)
|
if i >= 0 && INDEX_VALID(index,arrEnd,a)
|
||||||
then liftIO $ do
|
then liftIO $ do
|
||||||
r <- peekWith arrContents index
|
r <- peekWith arrContents index
|
||||||
let (x, res) = f r
|
let (x, res) = f r
|
||||||
@ -584,7 +584,7 @@ modify f Array{..} = liftIO $
|
|||||||
where
|
where
|
||||||
|
|
||||||
go i =
|
go i =
|
||||||
when (INDEX_VALID(i,aEnd,a)) $ do
|
when (INDEX_VALID(i,arrEnd,a)) $ do
|
||||||
r <- peekWith arrContents i
|
r <- peekWith arrContents i
|
||||||
pokeWith arrContents i (f r)
|
pokeWith arrContents i (f r)
|
||||||
go (INDEX_NEXT(i,a))
|
go (INDEX_NEXT(i,a))
|
||||||
@ -618,9 +618,9 @@ swapIndices :: forall m a. (MonadIO m, Unboxed a)
|
|||||||
swapIndices i1 i2 Array{..} = liftIO $ do
|
swapIndices i1 i2 Array{..} = liftIO $ do
|
||||||
let t1 = INDEX_OF(arrStart,i1,a)
|
let t1 = INDEX_OF(arrStart,i1,a)
|
||||||
t2 = INDEX_OF(arrStart,i2,a)
|
t2 = INDEX_OF(arrStart,i2,a)
|
||||||
when (i1 < 0 || INDEX_INVALID(t1,aEnd,a))
|
when (i1 < 0 || INDEX_INVALID(t1,arrEnd,a))
|
||||||
$ invalidIndex "swapIndices" i1
|
$ invalidIndex "swapIndices" i1
|
||||||
when (i2 < 0 || INDEX_INVALID(t2,aEnd,a))
|
when (i2 < 0 || INDEX_INVALID(t2,arrEnd,a))
|
||||||
$ invalidIndex "swapIndices" i2
|
$ invalidIndex "swapIndices" i2
|
||||||
swapArrayByteIndices arrContents t1 t2
|
swapArrayByteIndices arrContents t1 t2
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ roundDownTo elemSize size = size - (size `mod` elemSize)
|
|||||||
{-# NOINLINE reallocAligned #-}
|
{-# NOINLINE reallocAligned #-}
|
||||||
reallocAligned :: Int -> Int -> Int -> Array a -> IO (Array a)
|
reallocAligned :: Int -> Int -> Int -> Array a -> IO (Array a)
|
||||||
reallocAligned elemSize alignSize newCapacityInBytes Array{..} = do
|
reallocAligned elemSize alignSize newCapacityInBytes Array{..} = do
|
||||||
assertM(aEnd <= aBound)
|
assertM(arrEnd <= arrBound)
|
||||||
|
|
||||||
-- Allocate new array
|
-- Allocate new array
|
||||||
let newCapMaxInBytes = roundUpLargeArray newCapacityInBytes
|
let newCapMaxInBytes = roundUpLargeArray newCapacityInBytes
|
||||||
@ -732,7 +732,7 @@ reallocAligned elemSize alignSize newCapacityInBytes Array{..} = do
|
|||||||
-- Copy old data
|
-- Copy old data
|
||||||
let oldStart = arrStart
|
let oldStart = arrStart
|
||||||
!(I# oldStartInBytes#) = oldStart
|
!(I# oldStartInBytes#) = oldStart
|
||||||
oldSizeInBytes = aEnd - oldStart
|
oldSizeInBytes = arrEnd - oldStart
|
||||||
newCapInBytes = roundDownTo elemSize newCapMaxInBytes
|
newCapInBytes = roundDownTo elemSize newCapMaxInBytes
|
||||||
!newLenInBytes@(I# newLenInBytes#) = min oldSizeInBytes newCapInBytes
|
!newLenInBytes@(I# newLenInBytes#) = min oldSizeInBytes newCapInBytes
|
||||||
assert (oldSizeInBytes `mod` elemSize == 0) (return ())
|
assert (oldSizeInBytes `mod` elemSize == 0) (return ())
|
||||||
@ -744,8 +744,8 @@ reallocAligned elemSize alignSize newCapacityInBytes Array{..} = do
|
|||||||
return $ Array
|
return $ Array
|
||||||
{ arrStart = 0
|
{ arrStart = 0
|
||||||
, arrContents = contents
|
, arrContents = contents
|
||||||
, aEnd = newLenInBytes
|
, arrEnd = newLenInBytes
|
||||||
, aBound = newCapInBytes
|
, arrBound = newCapInBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | @realloc newCapacity array@ reallocates the array to the specified
|
-- | @realloc newCapacity array@ reallocates the array to the specified
|
||||||
@ -771,7 +771,7 @@ reallocWith :: forall m a. (MonadIO m , Unboxed a) =>
|
|||||||
-> Array a
|
-> Array a
|
||||||
-> m (Array a)
|
-> m (Array a)
|
||||||
reallocWith label capSizer minIncrBytes arr = do
|
reallocWith label capSizer minIncrBytes arr = do
|
||||||
let oldSizeBytes = aEnd arr - arrStart arr
|
let oldSizeBytes = arrEnd arr - arrStart arr
|
||||||
newCapBytes = capSizer oldSizeBytes
|
newCapBytes = capSizer oldSizeBytes
|
||||||
newSizeBytes = oldSizeBytes + minIncrBytes
|
newSizeBytes = oldSizeBytes + minIncrBytes
|
||||||
safeCapBytes = max newCapBytes newSizeBytes
|
safeCapBytes = max newCapBytes newSizeBytes
|
||||||
@ -802,7 +802,7 @@ resize :: forall m a. (MonadIO m, Unboxed a) =>
|
|||||||
Int -> Array a -> m (Array a)
|
Int -> Array a -> m (Array a)
|
||||||
resize nElems arr@Array{..} = do
|
resize nElems arr@Array{..} = do
|
||||||
let req = SIZE_OF(a) * nElems
|
let req = SIZE_OF(a) * nElems
|
||||||
len = aEnd - arrStart
|
len = arrEnd - arrStart
|
||||||
if req < len
|
if req < len
|
||||||
then return arr
|
then return arr
|
||||||
else realloc req arr
|
else realloc req arr
|
||||||
@ -820,7 +820,7 @@ resizeExp nElems arr@Array{..} = do
|
|||||||
if req > largeObjectThreshold
|
if req > largeObjectThreshold
|
||||||
then roundUpToPower2 req
|
then roundUpToPower2 req
|
||||||
else req
|
else req
|
||||||
len = aEnd - arrStart
|
len = arrEnd - arrStart
|
||||||
if req1 < len
|
if req1 < len
|
||||||
then return arr
|
then return arr
|
||||||
else realloc req1 arr
|
else realloc req1 arr
|
||||||
@ -836,12 +836,12 @@ resizeExp nElems arr@Array{..} = do
|
|||||||
{-# INLINE rightSize #-}
|
{-# INLINE rightSize #-}
|
||||||
rightSize :: forall m a. (MonadIO m, Unboxed a) => Array a -> m (Array a)
|
rightSize :: forall m a. (MonadIO m, Unboxed a) => Array a -> m (Array a)
|
||||||
rightSize arr@Array{..} = do
|
rightSize arr@Array{..} = do
|
||||||
assert (aEnd <= aBound) (return ())
|
assert (arrEnd <= arrBound) (return ())
|
||||||
let start = arrStart
|
let start = arrStart
|
||||||
len = aEnd - start
|
len = arrEnd - start
|
||||||
capacity = aBound - start
|
capacity = arrBound - start
|
||||||
target = roundUpLargeArray len
|
target = roundUpLargeArray len
|
||||||
waste = aBound - aEnd
|
waste = arrBound - arrEnd
|
||||||
assert (target >= len) (return ())
|
assert (target >= len) (return ())
|
||||||
assert (len `mod` SIZE_OF(a) == 0) (return ())
|
assert (len `mod` SIZE_OF(a) == 0) (return ())
|
||||||
-- We trade off some wastage (25%) to avoid reallocations and copying.
|
-- We trade off some wastage (25%) to avoid reallocations and copying.
|
||||||
@ -868,9 +868,9 @@ rightSize arr@Array{..} = do
|
|||||||
{-# INLINE snocNewEnd #-}
|
{-# INLINE snocNewEnd #-}
|
||||||
snocNewEnd :: (MonadIO m, Unboxed a) => Int -> Array a -> a -> m (Array a)
|
snocNewEnd :: (MonadIO m, Unboxed a) => Int -> Array a -> a -> m (Array a)
|
||||||
snocNewEnd newEnd arr@Array{..} x = liftIO $ do
|
snocNewEnd newEnd arr@Array{..} x = liftIO $ do
|
||||||
assert (newEnd <= aBound) (return ())
|
assert (newEnd <= arrBound) (return ())
|
||||||
pokeWith arrContents aEnd x
|
pokeWith arrContents arrEnd x
|
||||||
return $ arr {aEnd = newEnd}
|
return $ arr {arrEnd = newEnd}
|
||||||
|
|
||||||
-- | Really really unsafe, appends the element into the first array, may
|
-- | Really really unsafe, appends the element into the first array, may
|
||||||
-- cause silent data corruption or if you are lucky a segfault if the first
|
-- cause silent data corruption or if you are lucky a segfault if the first
|
||||||
@ -880,7 +880,7 @@ snocNewEnd newEnd arr@Array{..} x = liftIO $ do
|
|||||||
{-# INLINE snocUnsafe #-}
|
{-# INLINE snocUnsafe #-}
|
||||||
snocUnsafe :: forall m a. (MonadIO m, Unboxed a) =>
|
snocUnsafe :: forall m a. (MonadIO m, Unboxed a) =>
|
||||||
Array a -> a -> m (Array a)
|
Array a -> a -> m (Array a)
|
||||||
snocUnsafe arr@Array{..} = snocNewEnd (INDEX_NEXT(aEnd,a)) arr
|
snocUnsafe arr@Array{..} = snocNewEnd (INDEX_NEXT(arrEnd,a)) arr
|
||||||
|
|
||||||
-- | Like 'snoc' but does not reallocate when pre-allocated array capacity
|
-- | Like 'snoc' but does not reallocate when pre-allocated array capacity
|
||||||
-- becomes full.
|
-- becomes full.
|
||||||
@ -890,8 +890,8 @@ snocUnsafe arr@Array{..} = snocNewEnd (INDEX_NEXT(aEnd,a)) arr
|
|||||||
snocMay :: forall m a. (MonadIO m, Unboxed a) =>
|
snocMay :: forall m a. (MonadIO m, Unboxed a) =>
|
||||||
Array a -> a -> m (Maybe (Array a))
|
Array a -> a -> m (Maybe (Array a))
|
||||||
snocMay arr@Array{..} x = liftIO $ do
|
snocMay arr@Array{..} x = liftIO $ do
|
||||||
let newEnd = INDEX_NEXT(aEnd,a)
|
let newEnd = INDEX_NEXT(arrEnd,a)
|
||||||
if newEnd <= aBound
|
if newEnd <= arrBound
|
||||||
then Just <$> snocNewEnd newEnd arr x
|
then Just <$> snocNewEnd newEnd arr x
|
||||||
else return Nothing
|
else return Nothing
|
||||||
|
|
||||||
@ -926,8 +926,8 @@ snocWith :: forall m a. (MonadIO m, Unboxed a) =>
|
|||||||
-> a
|
-> a
|
||||||
-> m (Array a)
|
-> m (Array a)
|
||||||
snocWith allocSize arr x = liftIO $ do
|
snocWith allocSize arr x = liftIO $ do
|
||||||
let newEnd = INDEX_NEXT(aEnd arr,a)
|
let newEnd = INDEX_NEXT(arrEnd arr,a)
|
||||||
if newEnd <= aBound arr
|
if newEnd <= arrBound arr
|
||||||
then snocNewEnd newEnd arr x
|
then snocNewEnd newEnd arr x
|
||||||
else snocWithRealloc allocSize arr x
|
else snocWithRealloc allocSize arr x
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ snoc = snocWith f
|
|||||||
getIndexUnsafe :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
getIndexUnsafe :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
||||||
getIndexUnsafe i Array{..} = do
|
getIndexUnsafe i Array{..} = do
|
||||||
let index = INDEX_OF(arrStart,i,a)
|
let index = INDEX_OF(arrStart,i,a)
|
||||||
assert (i >= 0 && INDEX_VALID(index,aEnd,a)) (return ())
|
assert (i >= 0 && INDEX_VALID(index,arrEnd,a)) (return ())
|
||||||
liftIO $ peekWith arrContents index
|
liftIO $ peekWith arrContents index
|
||||||
|
|
||||||
-- | /O(1)/ Lookup the element at the given index. Index starts from 0.
|
-- | /O(1)/ Lookup the element at the given index. Index starts from 0.
|
||||||
@ -992,7 +992,7 @@ getIndexUnsafe i Array{..} = do
|
|||||||
getIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
getIndex :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
||||||
getIndex i Array{..} = do
|
getIndex i Array{..} = do
|
||||||
let index = INDEX_OF(arrStart,i,a)
|
let index = INDEX_OF(arrStart,i,a)
|
||||||
if i >= 0 && INDEX_VALID(index,aEnd,a)
|
if i >= 0 && INDEX_VALID(index,arrEnd,a)
|
||||||
then liftIO $ peekWith arrContents index
|
then liftIO $ peekWith arrContents index
|
||||||
else invalidIndex "getIndex" i
|
else invalidIndex "getIndex" i
|
||||||
|
|
||||||
@ -1004,7 +1004,7 @@ getIndex i Array{..} = do
|
|||||||
{-# INLINE getIndexRev #-}
|
{-# INLINE getIndexRev #-}
|
||||||
getIndexRev :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
getIndexRev :: forall m a. (MonadIO m, Unboxed a) => Int -> Array a -> m a
|
||||||
getIndexRev i Array{..} = do
|
getIndexRev i Array{..} = do
|
||||||
let index = RINDEX_OF(aEnd,i,a)
|
let index = RINDEX_OF(arrEnd,i,a)
|
||||||
if i >= 0 && index >= arrStart
|
if i >= 0 && index >= arrStart
|
||||||
then liftIO $ peekWith arrContents index
|
then liftIO $ peekWith arrContents index
|
||||||
else invalidIndex "getIndexRev" i
|
else invalidIndex "getIndexRev" i
|
||||||
@ -1106,7 +1106,7 @@ getSlice index len (Array contents start e _) =
|
|||||||
reverse :: forall m a. (MonadIO m, Unboxed a) => Array a -> m ()
|
reverse :: forall m a. (MonadIO m, Unboxed a) => Array a -> m ()
|
||||||
reverse Array{..} = liftIO $ do
|
reverse Array{..} = liftIO $ do
|
||||||
let l = arrStart
|
let l = arrStart
|
||||||
h = INDEX_PREV(aEnd,a)
|
h = INDEX_PREV(arrEnd,a)
|
||||||
in swap l h
|
in swap l h
|
||||||
|
|
||||||
where
|
where
|
||||||
@ -1133,12 +1133,12 @@ permute = undefined
|
|||||||
partitionBy :: forall m a. (MonadIO m, Unboxed a)
|
partitionBy :: forall m a. (MonadIO m, Unboxed a)
|
||||||
=> (a -> Bool) -> Array a -> m (Array a, Array a)
|
=> (a -> Bool) -> Array a -> m (Array a, Array a)
|
||||||
partitionBy f arr@Array{..} = liftIO $ do
|
partitionBy f arr@Array{..} = liftIO $ do
|
||||||
if arrStart >= aEnd
|
if arrStart >= arrEnd
|
||||||
then return (arr, arr)
|
then return (arr, arr)
|
||||||
else do
|
else do
|
||||||
ptr <- go arrStart (INDEX_PREV(aEnd,a))
|
ptr <- go arrStart (INDEX_PREV(arrEnd,a))
|
||||||
let pl = Array arrContents arrStart ptr ptr
|
let pl = Array arrContents arrStart ptr ptr
|
||||||
pr = Array arrContents ptr aEnd aEnd
|
pr = Array arrContents ptr arrEnd arrEnd
|
||||||
return (pl, pr)
|
return (pl, pr)
|
||||||
|
|
||||||
where
|
where
|
||||||
@ -1239,7 +1239,7 @@ mergeBy = undefined
|
|||||||
{-# INLINE byteLength #-}
|
{-# INLINE byteLength #-}
|
||||||
byteLength :: Array a -> Int
|
byteLength :: Array a -> Int
|
||||||
byteLength Array{..} =
|
byteLength Array{..} =
|
||||||
let len = aEnd - arrStart
|
let len = arrEnd - arrStart
|
||||||
in assert (len >= 0) len
|
in assert (len >= 0) len
|
||||||
|
|
||||||
-- Note: try to avoid the use of length in performance sensitive internal
|
-- Note: try to avoid the use of length in performance sensitive internal
|
||||||
@ -1267,7 +1267,7 @@ length arr =
|
|||||||
{-# INLINE byteCapacity #-}
|
{-# INLINE byteCapacity #-}
|
||||||
byteCapacity :: Array a -> Int
|
byteCapacity :: Array a -> Int
|
||||||
byteCapacity Array{..} =
|
byteCapacity Array{..} =
|
||||||
let len = aBound - arrStart
|
let len = arrBound - arrStart
|
||||||
in assert (len >= 0) len
|
in assert (len >= 0) len
|
||||||
|
|
||||||
-- | The remaining capacity in the array for appending more elements without
|
-- | The remaining capacity in the array for appending more elements without
|
||||||
@ -1277,7 +1277,7 @@ byteCapacity Array{..} =
|
|||||||
{-# INLINE bytesFree #-}
|
{-# INLINE bytesFree #-}
|
||||||
bytesFree :: Array a -> Int
|
bytesFree :: Array a -> Int
|
||||||
bytesFree Array{..} =
|
bytesFree Array{..} =
|
||||||
let n = aBound - aEnd
|
let n = arrBound - arrEnd
|
||||||
in assert (n >= 0) n
|
in assert (n >= 0) n
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -1377,7 +1377,7 @@ flattenArrays (D.Stream step state) = D.Stream step' (OuterLoop state)
|
|||||||
r <- step (adaptState gst) st
|
r <- step (adaptState gst) st
|
||||||
return $ case r of
|
return $ case r of
|
||||||
D.Yield Array{..} s ->
|
D.Yield Array{..} s ->
|
||||||
D.Skip (InnerLoop s arrContents arrStart aEnd)
|
D.Skip (InnerLoop s arrContents arrStart arrEnd)
|
||||||
D.Skip s -> D.Skip (OuterLoop s)
|
D.Skip s -> D.Skip (OuterLoop s)
|
||||||
D.Stop -> D.Stop
|
D.Stop -> D.Stop
|
||||||
|
|
||||||
@ -1406,7 +1406,7 @@ flattenArraysRev (D.Stream step state) = D.Stream step' (OuterLoop state)
|
|||||||
r <- step (adaptState gst) st
|
r <- step (adaptState gst) st
|
||||||
return $ case r of
|
return $ case r of
|
||||||
D.Yield Array{..} s ->
|
D.Yield Array{..} s ->
|
||||||
let p = INDEX_PREV(aEnd,a)
|
let p = INDEX_PREV(arrEnd,a)
|
||||||
in D.Skip (InnerLoop s arrContents p arrStart)
|
in D.Skip (InnerLoop s arrContents p arrStart)
|
||||||
D.Skip s -> D.Skip (OuterLoop s)
|
D.Skip s -> D.Skip (OuterLoop s)
|
||||||
D.Stop -> D.Stop
|
D.Stop -> D.Stop
|
||||||
@ -1508,7 +1508,7 @@ toListFB :: forall a b. Unboxed a => (a -> b -> b) -> b -> Array a -> b
|
|||||||
toListFB c n Array{..} = go arrStart
|
toListFB c n Array{..} = go arrStart
|
||||||
where
|
where
|
||||||
|
|
||||||
go p | assert (p <= aEnd) (p == aEnd) = n
|
go p | assert (p <= arrEnd) (p == arrEnd) = n
|
||||||
go p =
|
go p =
|
||||||
-- unsafeInlineIO allows us to run this in Identity monad for pure
|
-- unsafeInlineIO allows us to run this in Identity monad for pure
|
||||||
-- toList/foldr case which makes them much faster due to not
|
-- toList/foldr case which makes them much faster due to not
|
||||||
@ -1533,7 +1533,7 @@ toList :: forall m a. (MonadIO m, Unboxed a) => Array a -> m [a]
|
|||||||
toList Array{..} = liftIO $ go arrStart
|
toList Array{..} = liftIO $ go arrStart
|
||||||
where
|
where
|
||||||
|
|
||||||
go p | assert (p <= aEnd) (p == aEnd) = return []
|
go p | assert (p <= arrEnd) (p == arrEnd) = return []
|
||||||
go p = do
|
go p = do
|
||||||
x <- peekWith arrContents p
|
x <- peekWith arrContents p
|
||||||
(:) x <$> go (INDEX_NEXT(p,a))
|
(:) x <$> go (INDEX_NEXT(p,a))
|
||||||
@ -1547,7 +1547,7 @@ toStreamDWith liftio Array{..} = D.Stream step arrStart
|
|||||||
where
|
where
|
||||||
|
|
||||||
{-# INLINE_LATE step #-}
|
{-# INLINE_LATE step #-}
|
||||||
step _ p | assert (p <= aEnd) (p == aEnd) = return D.Stop
|
step _ p | assert (p <= arrEnd) (p == arrEnd) = return D.Stop
|
||||||
step _ p = liftio $ do
|
step _ p = liftio $ do
|
||||||
r <- peekWith arrContents p
|
r <- peekWith arrContents p
|
||||||
return $ D.Yield r (INDEX_NEXT(p,a))
|
return $ D.Yield r (INDEX_NEXT(p,a))
|
||||||
@ -1569,7 +1569,7 @@ toStreamKWith liftio Array{..} = go arrStart
|
|||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
go p | assert (p <= aEnd) (p == aEnd) = K.nil
|
go p | assert (p <= arrEnd) (p == arrEnd) = K.nil
|
||||||
| otherwise =
|
| otherwise =
|
||||||
let elemM = peekWith arrContents p
|
let elemM = peekWith arrContents p
|
||||||
in liftio elemM `K.consM` go (INDEX_NEXT(p,a))
|
in liftio elemM `K.consM` go (INDEX_NEXT(p,a))
|
||||||
@ -1583,7 +1583,7 @@ toStreamDRevWith ::
|
|||||||
forall m a. (Monad m, Unboxed a)
|
forall m a. (Monad m, Unboxed a)
|
||||||
=> (forall b. IO b -> m b) -> Array a -> D.Stream m a
|
=> (forall b. IO b -> m b) -> Array a -> D.Stream m a
|
||||||
toStreamDRevWith liftio Array{..} =
|
toStreamDRevWith liftio Array{..} =
|
||||||
let p = INDEX_PREV(aEnd,a)
|
let p = INDEX_PREV(arrEnd,a)
|
||||||
in D.Stream step p
|
in D.Stream step p
|
||||||
|
|
||||||
where
|
where
|
||||||
@ -1608,7 +1608,7 @@ toStreamKRevWith ::
|
|||||||
forall m a. (Monad m, Unboxed a)
|
forall m a. (Monad m, Unboxed a)
|
||||||
=> (forall b. IO b -> m b) -> Array a -> K.Stream m a
|
=> (forall b. IO b -> m b) -> Array a -> K.Stream m a
|
||||||
toStreamKRevWith liftio Array {..} =
|
toStreamKRevWith liftio Array {..} =
|
||||||
let p = INDEX_PREV(aEnd,a)
|
let p = INDEX_PREV(arrEnd,a)
|
||||||
in go p
|
in go p
|
||||||
|
|
||||||
where
|
where
|
||||||
@ -1938,8 +1938,8 @@ fromStreamDN :: forall m a. (MonadIO m, Unboxed a)
|
|||||||
-- fromStreamDN n = D.fold (writeN n)
|
-- fromStreamDN n = D.fold (writeN n)
|
||||||
fromStreamDN limit str = do
|
fromStreamDN limit str = do
|
||||||
arr <- liftIO $ newArray limit
|
arr <- liftIO $ newArray limit
|
||||||
end <- D.foldlM' (fwrite (arrContents arr)) (return $ aEnd arr) $ D.take limit str
|
end <- D.foldlM' (fwrite (arrContents arr)) (return $ arrEnd arr) $ D.take limit str
|
||||||
return $ arr {aEnd = end}
|
return $ arr {arrEnd = end}
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -2022,8 +2022,8 @@ fromListRev xs = fromListRevN (Prelude.length xs) xs
|
|||||||
{-# INLINE putSliceUnsafe #-}
|
{-# INLINE putSliceUnsafe #-}
|
||||||
putSliceUnsafe :: MonadIO m => Array a -> Int -> Array a -> Int -> Int -> m ()
|
putSliceUnsafe :: MonadIO m => Array a -> Int -> Array a -> Int -> Int -> m ()
|
||||||
putSliceUnsafe src srcStartBytes dst dstStartBytes lenBytes = liftIO $ do
|
putSliceUnsafe src srcStartBytes dst dstStartBytes lenBytes = liftIO $ do
|
||||||
assertM(lenBytes <= aBound dst - dstStartBytes)
|
assertM(lenBytes <= arrBound dst - dstStartBytes)
|
||||||
assertM(lenBytes <= aEnd src - srcStartBytes)
|
assertM(lenBytes <= arrEnd src - srcStartBytes)
|
||||||
let !(I# srcStartBytes#) = srcStartBytes
|
let !(I# srcStartBytes#) = srcStartBytes
|
||||||
!(I# dstStartBytes#) = dstStartBytes
|
!(I# dstStartBytes#) = dstStartBytes
|
||||||
!(I# lenBytes#) = lenBytes
|
!(I# lenBytes#) = lenBytes
|
||||||
@ -2040,8 +2040,8 @@ spliceCopy :: forall m a. (MonadIO m, Unboxed a) =>
|
|||||||
spliceCopy arr1 arr2 = liftIO $ do
|
spliceCopy arr1 arr2 = liftIO $ do
|
||||||
let start1 = arrStart arr1
|
let start1 = arrStart arr1
|
||||||
start2 = arrStart arr2
|
start2 = arrStart arr2
|
||||||
len1 = aEnd arr1 - start1
|
len1 = arrEnd arr1 - start1
|
||||||
len2 = aEnd arr2 - start2
|
len2 = arrEnd arr2 - start2
|
||||||
newArrContents <-
|
newArrContents <-
|
||||||
liftIO
|
liftIO
|
||||||
$ newAlignedArrayContents
|
$ newAlignedArrayContents
|
||||||
@ -2062,11 +2062,11 @@ spliceUnsafe :: MonadIO m =>
|
|||||||
spliceUnsafe dst src =
|
spliceUnsafe dst src =
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
let startSrc = arrStart src
|
let startSrc = arrStart src
|
||||||
srcLen = aEnd src - startSrc
|
srcLen = arrEnd src - startSrc
|
||||||
endDst = aEnd dst
|
endDst = arrEnd dst
|
||||||
assertM(endDst + srcLen <= aBound dst)
|
assertM(endDst + srcLen <= arrBound dst)
|
||||||
putSliceUnsafe src startSrc dst endDst srcLen
|
putSliceUnsafe src startSrc dst endDst srcLen
|
||||||
return $ dst {aEnd = endDst + srcLen}
|
return $ dst {arrEnd = endDst + srcLen}
|
||||||
|
|
||||||
-- | @spliceWith sizer dst src@ mutates @dst@ to append @src@. If there is no
|
-- | @spliceWith sizer dst src@ mutates @dst@ to append @src@. If there is no
|
||||||
-- reserved space available in @dst@ it is reallocated to a size determined by
|
-- reserved space available in @dst@ it is reallocated to a size determined by
|
||||||
@ -2085,7 +2085,7 @@ spliceWith sizer dst@(Array _ start end bound) src = do
|
|||||||
in D.fold f (toStreamD src)
|
in D.fold f (toStreamD src)
|
||||||
-}
|
-}
|
||||||
assert (end <= bound) (return ())
|
assert (end <= bound) (return ())
|
||||||
let srcBytes = aEnd src - arrStart src
|
let srcBytes = arrEnd src - arrStart src
|
||||||
|
|
||||||
dst1 <-
|
dst1 <-
|
||||||
if end + srcBytes >= bound
|
if end + srcBytes >= bound
|
||||||
@ -2149,14 +2149,14 @@ breakOn sep arr@Array{..} = asPtrUnsafe arr $ \p -> liftIO $ do
|
|||||||
( Array
|
( Array
|
||||||
{ arrContents = arrContents
|
{ arrContents = arrContents
|
||||||
, arrStart = arrStart
|
, arrStart = arrStart
|
||||||
, aEnd = arrStart + sepIndex -- exclude the separator
|
, arrEnd = arrStart + sepIndex -- exclude the separator
|
||||||
, aBound = arrStart + sepIndex
|
, arrBound = arrStart + sepIndex
|
||||||
}
|
}
|
||||||
, Just $ Array
|
, Just $ Array
|
||||||
{ arrContents = arrContents
|
{ arrContents = arrContents
|
||||||
, arrStart = arrStart + (sepIndex + 1)
|
, arrStart = arrStart + (sepIndex + 1)
|
||||||
, aEnd = aEnd
|
, arrEnd = arrEnd
|
||||||
, aBound = aBound
|
, arrBound = arrBound
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2177,14 +2177,14 @@ splitAt i arr@Array{..} =
|
|||||||
in ( Array
|
in ( Array
|
||||||
{ arrContents = arrContents
|
{ arrContents = arrContents
|
||||||
, arrStart = arrStart
|
, arrStart = arrStart
|
||||||
, aEnd = p
|
, arrEnd = p
|
||||||
, aBound = p
|
, arrBound = p
|
||||||
}
|
}
|
||||||
, Array
|
, Array
|
||||||
{ arrContents = arrContents
|
{ arrContents = arrContents
|
||||||
, arrStart = p
|
, arrStart = p
|
||||||
, aEnd = aEnd
|
, arrEnd = arrEnd
|
||||||
, aBound = aBound
|
, arrBound = arrBound
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2327,8 +2327,8 @@ strip :: forall a m. (Unboxed a, MonadIO m) =>
|
|||||||
(a -> Bool) -> Array a -> m (Array a)
|
(a -> Bool) -> Array a -> m (Array a)
|
||||||
strip eq arr@Array{..} = liftIO $ do
|
strip eq arr@Array{..} = liftIO $ do
|
||||||
st <- getStart arrStart
|
st <- getStart arrStart
|
||||||
end <- getLast aEnd st
|
end <- getLast arrEnd st
|
||||||
return arr {arrStart = st, aEnd = end, aBound = end}
|
return arr {arrStart = st, arrEnd = end, arrBound = end}
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -2338,12 +2338,12 @@ strip eq arr@Array{..} = liftIO $ do
|
|||||||
r <- liftIO $ D.head $ D.findIndices (not . eq) $ toStreamD arr
|
r <- liftIO $ D.head $ D.findIndices (not . eq) $ toStreamD arr
|
||||||
pure $
|
pure $
|
||||||
case r of
|
case r of
|
||||||
Nothing -> aEnd
|
Nothing -> arrEnd
|
||||||
Just i -> PTR_INDEX(arrStart,i,a)
|
Just i -> PTR_INDEX(arrStart,i,a)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
getStart cur = do
|
getStart cur = do
|
||||||
if cur < aEnd
|
if cur < arrEnd
|
||||||
then do
|
then do
|
||||||
r <- peekWith arrContents cur
|
r <- peekWith arrContents cur
|
||||||
if eq r
|
if eq r
|
||||||
|
@ -139,7 +139,7 @@ data Array a =
|
|||||||
Array
|
Array
|
||||||
{ arrContents :: {-# UNPACK #-} !(ArrayContents a)
|
{ arrContents :: {-# UNPACK #-} !(ArrayContents a)
|
||||||
, arrStart :: {-# UNPACK #-} !Int -- offset
|
, arrStart :: {-# UNPACK #-} !Int -- offset
|
||||||
, aEnd :: {-# UNPACK #-} !Int -- offset + len
|
, arrEnd :: {-# UNPACK #-} !Int -- offset + len
|
||||||
}
|
}
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -416,7 +416,7 @@ toListFB :: forall a b. Unboxed a => (a -> b -> b) -> b -> Array a -> b
|
|||||||
toListFB c n Array{..} = go arrStart
|
toListFB c n Array{..} = go arrStart
|
||||||
where
|
where
|
||||||
|
|
||||||
go p | assert (p <= aEnd) (p == aEnd) = n
|
go p | assert (p <= arrEnd) (p == arrEnd) = n
|
||||||
go p =
|
go p =
|
||||||
-- unsafeInlineIO allows us to run this in Identity monad for pure
|
-- unsafeInlineIO allows us to run this in Identity monad for pure
|
||||||
-- toList/foldr case which makes them much faster due to not
|
-- toList/foldr case which makes them much faster due to not
|
||||||
@ -570,7 +570,7 @@ toStreamD_ size Array{..} = D.Stream step arrStart
|
|||||||
where
|
where
|
||||||
|
|
||||||
{-# INLINE_LATE step #-}
|
{-# INLINE_LATE step #-}
|
||||||
step _ p | p == aEnd = return D.Stop
|
step _ p | p == arrEnd = return D.Stop
|
||||||
step _ p = liftIO $ do
|
step _ p = liftIO $ do
|
||||||
x <- peekWith arrContents p
|
x <- peekWith arrContents p
|
||||||
return $ D.Yield x (p `plusPtr` size)
|
return $ D.Yield x (p `plusPtr` size)
|
||||||
|
@ -1125,7 +1125,7 @@ reverse' m = Stream step Nothing
|
|||||||
{-# INLINE_LATE step #-}
|
{-# INLINE_LATE step #-}
|
||||||
step _ Nothing = do
|
step _ Nothing = do
|
||||||
arr <- A.fromStreamD m
|
arr <- A.fromStreamD m
|
||||||
let p = A.aEnd arr `plusPtr` negate (sizeOfElem (undefined :: a))
|
let p = A.arrEnd arr `plusPtr` negate (sizeOfElem (undefined :: a))
|
||||||
return $ Skip $ Just (A.aStart arr, p)
|
return $ Skip $ Just (A.aStart arr, p)
|
||||||
|
|
||||||
step _ (Just (start, p)) | p < unsafeForeignPtrToPtr start = return Stop
|
step _ (Just (start, p)) | p < unsafeForeignPtrToPtr start = return Stop
|
||||||
|
@ -183,7 +183,7 @@ unlines sep (D.Stream step state) = D.Stream step' (OuterLoop state)
|
|||||||
r <- step (adaptState gst) st
|
r <- step (adaptState gst) st
|
||||||
return $ case r of
|
return $ case r of
|
||||||
D.Yield Array{..} s ->
|
D.Yield Array{..} s ->
|
||||||
D.Skip (InnerLoop s arrContents arrStart aEnd)
|
D.Skip (InnerLoop s arrContents arrStart arrEnd)
|
||||||
D.Skip s -> D.Skip (OuterLoop s)
|
D.Skip s -> D.Skip (OuterLoop s)
|
||||||
D.Stop -> D.Stop
|
D.Stop -> D.Stop
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ readArrayUpto size h = do
|
|||||||
n <- hGetBufSome h p size
|
n <- hGetBufSome h p size
|
||||||
let v = Array
|
let v = Array
|
||||||
{ aStart = ptr
|
{ aStart = ptr
|
||||||
, aEnd = p `plusPtr` n
|
, arrEnd = p `plusPtr` n
|
||||||
, aBound = p `plusPtr` size
|
, arrBound = p `plusPtr` size
|
||||||
}
|
}
|
||||||
-- XXX shrink only if the diff is significant
|
-- XXX shrink only if the diff is significant
|
||||||
shrinkToFit v
|
shrinkToFit v
|
||||||
@ -300,7 +300,7 @@ writeArray h Array{..} = withForeignPtr aStart $ \p -> hPutBuf h p aLen
|
|||||||
where
|
where
|
||||||
aLen =
|
aLen =
|
||||||
let p = unsafeForeignPtrToPtr aStart
|
let p = unsafeForeignPtrToPtr aStart
|
||||||
in aEnd `minusPtr` p
|
in arrEnd `minusPtr` p
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Stream of Arrays IO
|
-- Stream of Arrays IO
|
||||||
|
@ -227,7 +227,7 @@ readArrayUpto size (Handle fd) = do
|
|||||||
-- Use unsafeFreezeWithShrink
|
-- Use unsafeFreezeWithShrink
|
||||||
return
|
return
|
||||||
$ unsafeFreeze
|
$ unsafeFreeze
|
||||||
$ arr { MArray.aEnd = n, MArray.aBound = size }
|
$ arr { MArray.arrEnd = n, MArray.arrBound = size }
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Array IO (output)
|
-- Array IO (output)
|
||||||
@ -250,7 +250,7 @@ writeArray (Handle fd) arr =
|
|||||||
{-
|
{-
|
||||||
-- Experiment to compare "writev" based IO with "write" based IO.
|
-- Experiment to compare "writev" based IO with "write" based IO.
|
||||||
iov <- A.newArray 1
|
iov <- A.newArray 1
|
||||||
let iov' = iov {aEnd = aBound iov}
|
let iov' = iov {arrEnd = arrBound iov}
|
||||||
A.writeIndex iov' 0 (RawIO.IOVec (castPtr p) (fromIntegral aLen))
|
A.writeIndex iov' 0 (RawIO.IOVec (castPtr p) (fromIntegral aLen))
|
||||||
RawIO.writevAll fd (unsafeForeignPtrToPtr (aStart iov')) 1
|
RawIO.writevAll fd (unsafeForeignPtrToPtr (aStart iov')) 1
|
||||||
-}
|
-}
|
||||||
|
@ -187,7 +187,7 @@ getChunk size h = liftIO $ do
|
|||||||
-- XXX shrink only if the diff is significant
|
-- XXX shrink only if the diff is significant
|
||||||
return $
|
return $
|
||||||
unsafeFreezeWithShrink $
|
unsafeFreezeWithShrink $
|
||||||
arr { MArray.aEnd = n, MArray.aBound = size }
|
arr { MArray.arrEnd = n, MArray.arrBound = size }
|
||||||
|
|
||||||
-- This could be useful in implementing the "reverse" read APIs or if you want
|
-- This could be useful in implementing the "reverse" read APIs or if you want
|
||||||
-- to read arrays of exact size instead of compacting them later. Compacting
|
-- to read arrays of exact size instead of compacting them later. Compacting
|
||||||
|
@ -263,7 +263,7 @@ readArrayUptoWith f size h = do
|
|||||||
MArray.asPtrUnsafe arr $ \p -> do
|
MArray.asPtrUnsafe arr $ \p -> do
|
||||||
n <- f h p size
|
n <- f h p size
|
||||||
let v = A.unsafeFreeze
|
let v = A.unsafeFreeze
|
||||||
$ arr { MArray.aEnd = n, MArray.aBound = size }
|
$ arr { MArray.arrEnd = n, MArray.arrBound = size }
|
||||||
|
|
||||||
-- XXX shrink only if the diff is significant
|
-- XXX shrink only if the diff is significant
|
||||||
-- A.shrinkToFit v
|
-- A.shrinkToFit v
|
||||||
|
@ -748,7 +748,7 @@ decodeUtf8ArraysWithD cfm (Stream step state) =
|
|||||||
return $
|
return $
|
||||||
case r of
|
case r of
|
||||||
Yield A.Array {..} s ->
|
Yield A.Array {..} s ->
|
||||||
Skip (InnerLoopDecodeInit s arrContents arrStart aEnd)
|
Skip (InnerLoopDecodeInit s arrContents arrStart arrEnd)
|
||||||
Skip s -> Skip (OuterLoop s Nothing)
|
Skip s -> Skip (OuterLoop s Nothing)
|
||||||
Stop -> Skip D
|
Stop -> Skip D
|
||||||
step' _ gst (OuterLoop st dst@(Just (ds, cp))) = do
|
step' _ gst (OuterLoop st dst@(Just (ds, cp))) = do
|
||||||
@ -756,7 +756,7 @@ decodeUtf8ArraysWithD cfm (Stream step state) =
|
|||||||
return $
|
return $
|
||||||
case r of
|
case r of
|
||||||
Yield A.Array {..} s ->
|
Yield A.Array {..} s ->
|
||||||
Skip (InnerLoopDecoding s arrContents arrStart aEnd ds cp)
|
Skip (InnerLoopDecoding s arrContents arrStart arrEnd ds cp)
|
||||||
Skip s -> Skip (OuterLoop s dst)
|
Skip s -> Skip (OuterLoop s dst)
|
||||||
Stop -> Skip inputUnderflow
|
Stop -> Skip inputUnderflow
|
||||||
step' _ _ (InnerLoopDecodeInit st _ p end)
|
step' _ _ (InnerLoopDecodeInit st _ p end)
|
||||||
|
Loading…
Reference in New Issue
Block a user