From 811176ad535410bc7c2d1002236af29e56d2ec0f Mon Sep 17 00:00:00 2001 From: kayomn Date: Sun, 19 Feb 2023 14:15:11 +0000 Subject: [PATCH] Expose way to zero memory in core library --- source/core.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/core.cpp b/source/core.cpp index 88b1140..3e6cc0f 100644 --- a/source/core.cpp +++ b/source/core.cpp @@ -480,7 +480,14 @@ export namespace core { void copy(slice const & target, slice const & origin) { if (target.length < origin.length) core::unreachable(); - for (usize i = 0; i < origin.length; i += 1) target[i] = origin[i]; + for (usize i = 0; i < target.length; i += 1) target[i] = origin[i]; + } + + /** + * Zeroes the contents of `target`. + */ + void zero(slice const & target) { + for (usize i = 0; i < target.length; i += 1) target[i] = 0; } /**