summaryrefslogtreecommitdiff
path: root/qstd
diff options
context:
space:
mode:
Diffstat (limited to 'qstd')
-rw-r--r--qstd/memory.c6
-rw-r--r--qstd/memory.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/qstd/memory.c b/qstd/memory.c
index 81795d6..b12ec75 100644
--- a/qstd/memory.c
+++ b/qstd/memory.c
@@ -11,6 +11,12 @@ int align_size(int s, int a) {
return (s + (a - 1)) & -a;
}
+void zero(void* buf, int size) {
+ int i;
+ for (i = 0; i < size; i++)
+ ((uint8_t*)buf)[i] = 0;
+}
+
static uintptr_t align_address(
uintptr_t ad,
size_t al
diff --git a/qstd/memory.h b/qstd/memory.h
index 842cb49..c723131 100644
--- a/qstd/memory.h
+++ b/qstd/memory.h
@@ -4,6 +4,8 @@
int aligned(const void* p, int a);
int align_size(int s, int a);
+void zero(void* buf, int size);
+
typedef struct Arena {
char* buf;
int size, ptr;