Skip to content

Commit

Permalink
Use copyMutableByteArrayNonOverlapping# when available
Browse files Browse the repository at this point in the history
  • Loading branch information
clyring authored and andrewthad committed Jan 4, 2024
1 parent 0ea3f65 commit 5f99571
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Data/Primitive/ByteArray.hs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,13 @@ copyMutableByteArray
{-# INLINE copyMutableByteArray #-}
copyMutableByteArray (MutableByteArray dst#) doff
(MutableByteArray src#) soff sz
= primitive_ (copyMutableByteArray# src# (unI# soff) dst# (unI# doff) (unI# sz))
= primitive_ (op src# (unI# soff) dst# (unI# doff) (unI# sz))
where
#if MIN_VERSION_base(4,19,0)
op = copyMutableByteArrayNonOverlapping#
#else
op = copyMutableByteArray#
#endif

-- | Copy a slice of a byte array to an unmanaged pointer address. These must not
-- overlap. The offset and length are given in elements, not in bytes.
Expand Down

0 comments on commit 5f99571

Please sign in to comment.