summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-04-07 15:11:13 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-08 23:57:16 +0200
commite8ef10e2a6364889dc090f34a153cbbf26a8a6bc (patch)
tree5c7b7b9a0bf67506fddb822f9c067e5beb72b397 /Kernel
parent74de4795dcabf8d5bbea7390045a56ced8d2de51 (diff)
downloadserenity-e8ef10e2a6364889dc090f34a153cbbf26a8a6bc.zip
Kernel/LibC: Make memset implementations the same
I dont know why we do a fast path in the Kernel, but not in Userspace Also simplified the byte explosion in memset to "explode_byte" it even seemed so, that we missed the highest byte when memseting something
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/StdLib.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp
index 6fd793635b..a54086d875 100644
--- a/Kernel/StdLib.cpp
+++ b/Kernel/StdLib.cpp
@@ -282,9 +282,7 @@ void* memset(void* dest_ptr, int c, size_t n)
// FIXME: Support starting at an unaligned address.
if (!(dest & 0x3) && n >= 12) {
size_t size_ts = n / sizeof(size_t);
- size_t expanded_c = (u8)c;
- expanded_c |= expanded_c << 8;
- expanded_c |= expanded_c << 16;
+ size_t expanded_c = explode_byte((u8)c);
asm volatile(
"rep stosl\n"
: "=D"(dest)