From 46f72c5c930419aa57aca0d8480d1ccc9131d590 Mon Sep 17 00:00:00 2001 From: sigsegv7 Date: Wed, 11 Oct 2023 16:43:56 -0400 Subject: kernel: lib: Add memset64() Signed-off-by: sigsegv7 --- sys/include/lib/string.h | 1 + sys/lib/string/memset.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/sys/include/lib/string.h b/sys/include/lib/string.h index 8668b01..52403be 100644 --- a/sys/include/lib/string.h +++ b/sys/include/lib/string.h @@ -38,6 +38,7 @@ void *memmove(void *s1, const void *s2, size_t n); void *memcpy(void *dest, const void *src, size_t n); void *memcpy32(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); +void *memset64(void *s, int c, size_t n); int memcmp(const void *s1, const void *s2, size_t n); #endif /* !_LIB_STRING_H_ */ diff --git a/sys/lib/string/memset.c b/sys/lib/string/memset.c index f8f3c9c..df0672c 100644 --- a/sys/lib/string/memset.c +++ b/sys/lib/string/memset.c @@ -38,3 +38,13 @@ memset(void *s, int c, size_t n) return s; } + +void * +memset64(void *s, int c, size_t n) +{ + for (size_t i = 0; i < n; ++i) { + ((uint32_t *)s)[i] = c; + } + + return s; +} -- cgit v1.2.3