shithub: mc

Download patch

ref: b0886832a75e9d63f49cb878ed8abc56f37120c0
parent: e3ee0361d0918fbf3d92ef7c4123cf6b0d9265a7
author: Ori Bernstein <[email protected]>
date: Wed Aug 7 12:47:24 EDT 2013

Add slice copying code.

--- /dev/null
+++ b/libstd/slcp.myr
@@ -1,0 +1,16 @@
+use "die.use"
+
+pkg std =
+	generic slcp : (a : @a[:], b : @a[:] -> void)
+;;
+
+generic slcp = {a, b
+	var i
+
+	assert(a.len == b.len, "arguments to slcp() must be of equal length")
+
+	for i = 0; i < a.len; i++
+		a[i] = b[i]
+	;;
+}
+