File indexing completed on 2025-01-18 09:27:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef ABSL_CRC_INTERNAL_CRC32C_INLINE_H_
0016 #define ABSL_CRC_INTERNAL_CRC32C_INLINE_H_
0017
0018 #include <cstdint>
0019
0020 #include "absl/base/config.h"
0021 #include "absl/base/internal/endian.h"
0022 #include "absl/crc/internal/crc32_x86_arm_combined_simd.h"
0023
0024 namespace absl {
0025 ABSL_NAMESPACE_BEGIN
0026 namespace crc_internal {
0027
0028
0029
0030
0031 inline bool ExtendCrc32cInline(uint32_t* crc, const char* p, size_t n) {
0032 #if defined(ABSL_CRC_INTERNAL_HAVE_ARM_SIMD) || \
0033 defined(ABSL_CRC_INTERNAL_HAVE_X86_SIMD)
0034 constexpr uint32_t kCrc32Xor = 0xffffffffU;
0035 *crc ^= kCrc32Xor;
0036 if (n & 1) {
0037 *crc = CRC32_u8(*crc, static_cast<uint8_t>(*p));
0038 n--;
0039 p++;
0040 }
0041 if (n & 2) {
0042 *crc = CRC32_u16(*crc, absl::little_endian::Load16(p));
0043 n -= 2;
0044 p += 2;
0045 }
0046 if (n & 4) {
0047 *crc = CRC32_u32(*crc, absl::little_endian::Load32(p));
0048 n -= 4;
0049 p += 4;
0050 }
0051 while (n) {
0052 *crc = CRC32_u64(*crc, absl::little_endian::Load64(p));
0053 n -= 8;
0054 p += 8;
0055 }
0056 *crc ^= kCrc32Xor;
0057 return true;
0058 #else
0059
0060 static_cast<void>(crc);
0061 static_cast<void>(p);
0062 static_cast<void>(n);
0063 return false;
0064 #endif
0065
0066 }
0067
0068 }
0069 ABSL_NAMESPACE_END
0070 }
0071
0072 #endif