summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-04-28 13:24:47 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 14:18:40 -0400
commit228d4670e98e4fd998c847aac38c11ad85aa35a7 (patch)
treefd74253ddadeddd98227f962ab78589bbaa3204a
parentb2c38d6b4003d3dda60d15204283da5aab15c2ec (diff)
downloadhaskell-228d4670e98e4fd998c847aac38c11ad85aa35a7.tar.gz
Use memcpy in cloneArray
While looking at #13615 I noticed that there was this strange open-coded memcpy in the definition of the cloneArray macro. I don't see why this should be preferable to memcpy. Test Plan: Validate, particularly focusing on array operations Reviewers: simonmar, tibbe, austin, alexbiehl Reviewed By: tibbe, alexbiehl Subscribers: alexbiehl, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3504
-rw-r--r--includes/Cmm.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 779416b6da..3c90307a77 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -849,14 +849,7 @@
\
dst_p = dst + SIZEOF_StgMutArrPtrs; \
src_p = src + SIZEOF_StgMutArrPtrs + WDS(offset); \
- while: \
- if (n != 0) { \
- n = n - 1; \
- W_[dst_p] = W_[src_p]; \
- dst_p = dst_p + WDS(1); \
- src_p = src_p + WDS(1); \
- goto while; \
- } \
+ prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \
\
return (dst);
@@ -931,13 +924,6 @@
\
dst_p = dst + SIZEOF_StgSmallMutArrPtrs; \
src_p = src + SIZEOF_StgSmallMutArrPtrs + WDS(offset); \
- while: \
- if (n != 0) { \
- n = n - 1; \
- W_[dst_p] = W_[src_p]; \
- dst_p = dst_p + WDS(1); \
- src_p = src_p + WDS(1); \
- goto while; \
- } \
+ prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \
\
return (dst);