Path: blob/main/contrib/llvm-project/compiler-rt/lib/scudo/standalone/crc32_hw.cpp
35292 views
//===-- crc32_hw.cpp --------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "checksum.h"910namespace scudo {1112#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)13u32 computeHardwareCRC32(u32 Crc, uptr Data) {14return static_cast<u32>(CRC32_INTRINSIC(Crc, Data));15}16#endif // defined(__CRC32__) || defined(__SSE4_2__) ||17// defined(__ARM_FEATURE_CRC32)1819#if defined(__loongarch__)20u32 computeHardwareCRC32(u32 Crc, uptr Data) {21// The LoongArch CRC intrinsics have the two input arguments swapped, and22// expect them to be signed.23return static_cast<u32>(24CRC32_INTRINSIC(static_cast<long>(Data), static_cast<int>(Crc)));25}26#endif // defined(__loongarch__)2728} // namespace scudo293031