diff options
Diffstat (limited to 'libs/kstd/src/libc')
| -rw-r--r-- | libs/kstd/src/libc/string.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/kstd/src/libc/string.cpp b/libs/kstd/src/libc/string.cpp index 4e264f9..302046d 100644 --- a/libs/kstd/src/libc/string.cpp +++ b/libs/kstd/src/libc/string.cpp @@ -22,9 +22,16 @@ namespace kstd::libc return dest;
}
- auto strlen(char const * string) -> std::size_t
+ auto memset(void * dest, std::byte value, std::size_t size) -> void *
{
- return std::distance(string, std::ranges::find(string, nullptr, '\0'));
+ auto dest_span = std::span{static_cast<std::byte *>(dest), size};
+
+ for (std::size_t i = 0; i < size; ++i)
+ {
+ dest_span[i] = value;
+ }
+
+ return dest;
}
auto memcmp(void const * lhs, void const * rhs, std::size_t size) -> std::size_t
@@ -62,4 +69,9 @@ namespace kstd::libc return dest;
}
+ auto strlen(char const * string) -> std::size_t
+ {
+ return std::distance(string, std::ranges::find(string, nullptr, '\0'));
+ }
+
} // namespace kstd::libc
\ No newline at end of file |
