summaryrefslogtreecommitdiff
path: root/lib/std/slcp.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-10-02 23:27:11 -0700
committerOri Bernstein <ori@eigenstate.org>2015-10-02 23:27:11 -0700
commit08442dd9c3426e2dbe598ef1f6fb10f2f67638aa (patch)
treef8a9d3092248258e5a33bb17fe3a985868ae2ef8 /lib/std/slcp.myr
parent76086513de9efd7a000d0bc229c3e990f0af5a2f (diff)
downloadmc-08442dd9c3426e2dbe598ef1f6fb10f2f67638aa.tar.gz
Implement some asm optimized memcpy/memmove checks.
TODO: memcmp
Diffstat (limited to 'lib/std/slcp.myr')
-rw-r--r--lib/std/slcp.myr19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/std/slcp.myr b/lib/std/slcp.myr
index b2c9760..a099bf3 100644
--- a/lib/std/slcp.myr
+++ b/lib/std/slcp.myr
@@ -1,25 +1,12 @@
use "die.use"
use "types.use"
+use "memops.use"
pkg std =
generic slcp : (a : @a[:], b : @a[:] -> void)
;;
generic slcp = {a : @a[:], b : @a[:]
- var addr_a, addr_b
-
- assert(a.len == b.len, "arguments to slcp() must be of equal length")
-
- addr_a = a castto(@a#) castto(intptr)
- addr_b = b castto(@a#) castto(intptr)
- if addr_a <= addr_b
- for var i = 0; i < a.len; i++
- a[i] = b[i]
- ;;
- else
- for var i = a.len; i > 0; i--
- a[i - 1] = b[i - 1]
- ;;
- ;;
-
+ assert(a.len == b.len, "arguments to slcp() must be of equal length\n")
+ memblit(a castto(byte#), b castto(byte#), a.len * sizeof(@a))
}