summaryrefslogtreecommitdiff
path: root/rgo/src/memfill.c
diff options
context:
space:
mode:
Diffstat (limited to 'rgo/src/memfill.c')
-rw-r--r--rgo/src/memfill.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/rgo/src/memfill.c b/rgo/src/memfill.c
deleted file mode 100644
index d4c27e0..0000000
--- a/rgo/src/memfill.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright 2022 Gabriel Jensen.
- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
- If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
-*/
-
-#include <rgo-priv.h>
-
-#include <stddef.h>
-#include <stdint.h>
-
-#if defined(rgo_priv_fastimpl)
-__asm__ (
- ".global rgo_memfill\n"
-
- "rgo_memfill:\n"
- /*
- void const * ptr
- size_t num
- uint_least8_t val
- */
-#if defined(sus_arch_amd64)
- /* rdi: Address of the current element. */
- /* rsi: Address of the element after the last element. */
- "addq %rdi,%rsi\n"
- ".loop:\n"
- "cmpq %rsi,%rdi\n"
- "je .done\n" /* Exit loop if we have reached the final element. */
- "movb %dl,(%rdi)\n"
- "incq %rdi\n"
- "jmp .loop\n" /* Continue to next element. */
- ".done:\n"
- "ret\n"
-#elif defined(sus_arch_ia32)
- /* eax: Address of the current element. */
- "movl 0x4(%esp),%eax\n"
- /* ecx: Address of the element after the last element. */
- "movl 0x4(%esp),%ecx\n"
- "addl 0x8(%esp),%ecx\n"
- /* edx: Byte value. */
- "movb 0xC(%esp),%dl\n"
- ".loop:\n"
- "cmpl %eax,%ecx\n"
- "je .done\n" /* Exit loop if we have reached the final element. */
- "movb %dl,(%eax)\n"
- "incl %eax\n"
- "jmp .loop\n" /* Continue to next element. */
- ".done:\n"
- "ret\n"
-#endif
-);
-#else
-void rgo_memfill(void * const _ptr,size_t const _num,uint_least8_t const _byte) {
- uint_least8_t * pos = (uint_least8_t *)_ptr;
- uint_least8_t * const afterbuf = pos + _num;
- for (;pos != afterbuf;++pos) {*pos = _byte;}
-}
-#endif