summaryrefslogtreecommitdiff
path: root/05/util.b
diff options
context:
space:
mode:
Diffstat (limited to '05/util.b')
-rw-r--r--05/util.b17
1 files changed, 17 insertions, 0 deletions
diff --git a/05/util.b b/05/util.b
index 35e6eee..f8c520e 100644
--- a/05/util.b
+++ b/05/util.b
@@ -112,6 +112,23 @@ function memccpy_advance
*8p_dest = dest
return
+; just like C
+function memcpy
+ argument dest
+ argument src
+ argument n
+ local p
+ local q
+ p = dest
+ q = src
+ :memcpy_loop
+ if n == 0 goto return_0
+ *1p = *1q
+ p += 1
+ q += 1
+ n -= 1
+ goto memcpy_loop
+
function strlen
argument s
local p