summaryrefslogtreecommitdiff
path: root/userland/libc/string/memcpy.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
committerAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
commitb033314bf1901d436dc71d41d5e1f37dda47e511 (patch)
tree120bd137888a7f96904a47af7d20422608ffe225 /userland/libc/string/memcpy.c
parentdcbcdbdc5bcfb86eca05fb655e3bf009d89e39e0 (diff)
formatting: Use clang-format on all projects
This commit also add braces to all `if` statements.
Diffstat (limited to 'userland/libc/string/memcpy.c')
-rw-r--r--userland/libc/string/memcpy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/userland/libc/string/memcpy.c b/userland/libc/string/memcpy.c
index 7a9f01e..65f646d 100644
--- a/userland/libc/string/memcpy.c
+++ b/userland/libc/string/memcpy.c
@@ -4,15 +4,19 @@ void *memcpy(void *dest, const void *src, uint32_t n) {
unsigned char *d = dest;
const unsigned char *s = src;
- for (; n >= 8; n -= 8, d += 8, s += 8)
+ for (; n >= 8; n -= 8, d += 8, s += 8) {
*(uint64_t *)d = *(uint64_t *)s;
+ }
- for (; n >= 4; n -= 4, d += 4, s += 4)
+ for (; n >= 4; n -= 4, d += 4, s += 4) {
*(uint32_t *)d = *(uint32_t *)s;
+ }
- for (; n >= 2; n -= 2, d += 2, s += 2)
+ for (; n >= 2; n -= 2, d += 2, s += 2) {
*(uint16_t *)d = *(uint16_t *)s;
- for (; n; n--)
+ }
+ for (; n; n--) {
*d++ = *s++;
+ }
return dest;
}