aboutsummaryrefslogtreecommitdiff
path: root/sys/libn/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libn/memory.c')
-rw-r--r--sys/libn/memory.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/libn/memory.c b/sys/libn/memory.c
index 8081569..7a0ca30 100644
--- a/sys/libn/memory.c
+++ b/sys/libn/memory.c
@@ -147,3 +147,20 @@ memĀ·freearena(memĀ·Arena *a)
a->heap.free(a->impl, a);
}
+
+// -------------------------------------------------------------------------
+// Generalized memory helpers
+
+void
+memset64(void *dst, uint64 val, uintptr size)
+{
+ intptr i;
+
+ for (i = 0; i < (size & (~7)); i += 8) {
+ memcpy((byte*)dst + i, &val, 8);
+ }
+
+ for (; i < size; i++) {
+ ((byte*)dst)[i] = ((byte*)&val)[i&7];
+ }
+}