summaryrefslogtreecommitdiff
path: root/libstd/slcp.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-08-07 16:47:24 -0400
committerOri Bernstein <ori@eigenstate.org>2013-08-07 16:47:24 -0400
commitb0886832a75e9d63f49cb878ed8abc56f37120c0 (patch)
treedba90bcf09aef629b4ba1500977859896a3f7c1a /libstd/slcp.myr
parente3ee0361d0918fbf3d92ef7c4123cf6b0d9265a7 (diff)
downloadmc-b0886832a75e9d63f49cb878ed8abc56f37120c0.tar.gz
Add slice copying code.
Diffstat (limited to 'libstd/slcp.myr')
-rw-r--r--libstd/slcp.myr16
1 files changed, 16 insertions, 0 deletions
diff --git a/libstd/slcp.myr b/libstd/slcp.myr
new file mode 100644
index 0000000..42813c8
--- /dev/null
+++ b/libstd/slcp.myr
@@ -0,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]
+ ;;
+}
+