aboutsummaryrefslogtreecommitdiff
path: root/sys/libn
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-26 17:36:49 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-26 17:36:49 -0700
commitec21325b36adc7f52179ea010ff7bb19d121a6c1 (patch)
treec4e0efd725015f35d7f48326ccf4e1fbf0cb757d /sys/libn
parent2738b2fa89a073661e466604aa942851bb289dfe (diff)
chore: moved string into main libn header
Diffstat (limited to 'sys/libn')
-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];
+ }
+}