1 //===-- Memset implementation for riscv -------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
9 #define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
10
11 #include "src/__support/macros/attributes.h" // LIBC_INLINE
12 #include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
13 #include "src/string/memory_utils/generic/aligned_access.h"
14 #include "src/string/memory_utils/utils.h" // Ptr, CPtr
15
16 #include <stddef.h> // size_t
17
18 namespace LIBC_NAMESPACE {
19
inline_memset_riscv(Ptr dst,uint8_t value,size_t count)20 LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value,
21 size_t count) {
22 #if defined(LIBC_TARGET_ARCH_IS_RISCV64)
23 return inline_memset_aligned_access_64bit(dst, value, count);
24 #elif defined(LIBC_TARGET_ARCH_IS_RISCV32)
25 return inline_memset_aligned_access_32bit(dst, value, count);
26 #else
27 #error "Unimplemented"
28 #endif
29 }
30
31 } // namespace LIBC_NAMESPACE
32
33 #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
34