brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · e41bdb6 Raw
50 lines · c
1//===-- Implementation of memset and bzero --------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMSET_H10#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMSET_H11 12#include "src/__support/macros/attributes.h"               // LIBC_INLINE13#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_14#include "src/string/memory_utils/utils.h"                 // Ptr, CPtr15 16#include <stddef.h> // size_t17 18#if defined(LIBC_TARGET_ARCH_IS_X86)19#include "src/string/memory_utils/x86_64/inline_memset.h"20#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_x8621#elif defined(LIBC_TARGET_ARCH_IS_ARM)22#include "src/string/memory_utils/arm/inline_memset.h"23#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_arm_dispatch24#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)25#include "src/string/memory_utils/aarch64/inline_memset.h"26#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_aarch64_dispatch27#elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)28#include "src/string/memory_utils/riscv/inline_memset.h"29#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_riscv30#elif defined(LIBC_TARGET_ARCH_IS_GPU)31#include "src/string/memory_utils/generic/builtin.h"32#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_builtin33#else34#include "src/string/memory_utils/generic/byte_per_byte.h"35#define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_byte_per_byte36#endif37 38namespace LIBC_NAMESPACE_DECL {39 40[[gnu::flatten]] LIBC_INLINE void inline_memset(void *dst, uint8_t value,41                                                size_t count) {42  LIBC_SRC_STRING_MEMORY_UTILS_MEMSET(reinterpret_cast<Ptr>(dst), value, count);43}44 45} // namespace LIBC_NAMESPACE_DECL46 47#undef LIBC_SRC_STRING_MEMORY_UTILS_MEMSET48 49#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMSET_H50