hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 2afd766174d392067b2e80013dfe6b362ea60cb3
parent ced0bc2172d4cd5169e3514997db069a813077b7
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sat, 28 Oct 2023 02:35:26 -0400

sort: replace rt::memmove with slice assignment

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Msort/sort.ha | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sort/sort.ha b/sort/sort.ha @@ -2,7 +2,6 @@ // (c) Hare authors <https://harelang.org> use math; -use rt; use types; // Sorts a slice of items in place. This function provides a stable sort - @@ -203,21 +202,21 @@ fn merge( let i = 0z, j = m, out = l; for (i < m - l && j < r; out += itemsz) { if (cmp(&aux[i], &items[j]) < 0) { - rt::memmove(&items[out], &aux[i], itemsz); + items[out..out + itemsz] = aux[i..i + itemsz]; i += itemsz; } else { - rt::memmove(&items[out], &items[j], itemsz); + items[out..out + itemsz] = items[j..j + itemsz]; j += itemsz; }; }; if (i < m - l) { const sz = (m - l) - i; - rt::memmove(&items[out], &aux[i], sz); + items[out..out + sz] = aux[i..i + sz]; out += sz; }; if (j < r) { const sz = r - j; - rt::memmove(&items[out], &items[j], sz); + items[out..out + sz] = items[j..j + sz]; out += sz; }; };