Skip to content

Commit

Permalink
Skip memmove in del_at_beg when not needed. (#24503)
Browse files Browse the repository at this point in the history
This was likely previously done on linux in the glibc implementation.

Fix #24494

(cherry picked from commit d7a171e)
  • Loading branch information
yuyichao authored and ararslan committed Nov 14, 2017
1 parent 03cfcc3 commit 637280f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,9 @@ STATIC_INLINE void jl_array_del_at_beg(jl_array_t *a, size_t idx, size_t dec,
nbtotal++;
if (idx > 0)
memmove(newdata, olddata, nb1);
memmove(newdata + nb1, olddata + nb1 + nbdec, nbtotal - nb1);
// Move the rest of the data if the offset changed
if (newoffs != offset)
memmove(newdata + nb1, olddata + nb1 + nbdec, nbtotal - nb1);
a->data = newdata;
}
else {
Expand Down

0 comments on commit 637280f

Please sign in to comment.