From c1dd082048dae08e8276d131e572e2a87bdd8f6e Mon Sep 17 00:00:00 2001 From: Matthew Craven Date: Thu, 4 Jan 2024 16:14:38 -0500 Subject: [PATCH] Use copyMutableByteArrayNonOverlapping# when available --- Data/Primitive/ByteArray.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Data/Primitive/ByteArray.hs b/Data/Primitive/ByteArray.hs index 25daddb..31272a5 100644 --- a/Data/Primitive/ByteArray.hs +++ b/Data/Primitive/ByteArray.hs @@ -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.