brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 955d764 Raw
46 lines · c
1//===-- Dispatch logic for bcmp -------------------------------------------===//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_BCMP_H10#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BCMP_H11 12#include "src/__support/common.h"13#include "src/__support/macros/attributes.h" // LIBC_INLINE14#include "src/__support/macros/config.h"     // LIBC_NAMESPACE_DECL15#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_16 17#include <stddef.h> // size_t18 19#if defined(LIBC_TARGET_ARCH_IS_X86)20#include "src/string/memory_utils/x86_64/inline_bcmp.h"21#define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_x8622#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)23#include "src/string/memory_utils/aarch64/inline_bcmp.h"24#define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_aarch64_dispatch25#elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)26#include "src/string/memory_utils/riscv/inline_bcmp.h"27#define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_riscv28#else29#include "src/string/memory_utils/generic/byte_per_byte.h"30#define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_byte_per_byte31#endif32 33namespace LIBC_NAMESPACE_DECL {34 35[[gnu::flatten]] LIBC_INLINE int inline_bcmp(const void *p1, const void *p2,36                                             size_t count) {37  return static_cast<int>(LIBC_SRC_STRING_MEMORY_UTILS_BCMP(38      reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count));39}40 41} // namespace LIBC_NAMESPACE_DECL42 43#undef LIBC_SRC_STRING_MEMORY_UTILS_BCMP44 45#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BCMP_H46