Debian Codegraph @

crt/aws-checksums/include/aws/checksums/private/crc64_priv.h

raw symbols SCIP
1 #ifndef AWS_CHECKSUMS_PRIVATE_CRC64_PRIV_H
2 #define AWS_CHECKSUMS_PRIVATE_CRC64_PRIV_H
3
4 /**
5 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 * SPDX-License-Identifier: Apache-2.0.
7 */
8
9 #include <aws/checksums/exports.h>
10 #include <aws/common/config.h>
11 #include <aws/common/macros.h>
12 #include <stdint.h>
13
14 AWS_EXTERN_C_BEGIN
15
16 AWS_CHECKSUMS_API uint64_t aws_checksums_crc64nvme_sw(const uint8_t *input, int length, uint64_t prev_crc64);
17
18 AWS_CHECKSUMS_API uint64_t aws_checksums_crc64nvme_combine_sw(uint64_t crc1, uint64_t crc2, uint64_t len2);
19
20 #if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_CLMUL) && \
21 !(defined(_MSC_VER) && _MSC_VER < 1920)
22 uint64_t aws_checksums_crc64nvme_intel_clmul(const uint8_t *input, int length, uint64_t previous_crc_64);
23 #endif /* defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_CLMUL) && !(defined(_MSC_VER) && _MSC_VER < 1920) */
24
25 #if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_AVX2_INTRINSICS) && \
26 !(defined(_MSC_VER) && _MSC_VER < 1920)
27 uint64_t aws_checksums_crc64nvme_intel_avx512(const uint8_t *input, int length, uint64_t previous_crc_64);
28
29 uint64_t aws_checksums_crc64nvme_combine_clmul(uint64_t crc1, uint64_t crc2, uint64_t len2);
30 #endif /* defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_AVX2_INTRINSICS) && !(defined(_MSC_VER) && _MSC_VER < 1920) \
31 */
32
33 #if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_ARM64)
34 uint64_t aws_checksums_crc64nvme_arm_pmull(const uint8_t *input, int length, uint64_t previous_crc_64);
35
36 uint64_t aws_checksums_crc64nvme_combine_arm_pmull(uint64_t crc1, uint64_t crc2, uint64_t len2);
37 #endif /* INTPTR_MAX == INT64_MAX && defined(AWS_HAVE_ARMv8_1) */
38
39 /* Pre-computed constants for CRC64 */
40 typedef struct {
41 uint64_t x2048[8]; /* x^2112 mod P(x) / x^2048 mod P(x) */
42 uint64_t x1536[8]; /* x^1600 mod P(x) / x^1536 mod P(x) */
43 uint64_t x1024[8]; /* x^1088 mod P(x) / x^1024 mod P(x) */
44 uint64_t x512[8]; /* x^576 mod P(x) / x^512 mod P(x) */
45 uint64_t x384[2]; /* x^448 mod P(x) / x^384 mod P(x) */
46 uint64_t x256[2]; /* x^320 mod P(x) / x^256 mod P(x) */
47 uint64_t x128[2]; /* x^192 mod P(x) / x^128 mod P(x) */
48 uint64_t mu_poly[2]; /* Barrett mu / polynomial P(x) */
49 uint64_t trailing[15][2]; /* Folding constants for 15 possible trailing input data lengths */
50 uint64_t shift_factors[16][16][2];
51 } aws_checksums_crc64_constants_t;
52
53 extern uint8_t aws_checksums_masks_shifts[6][16];
54 extern aws_checksums_crc64_constants_t aws_checksums_crc64nvme_constants;
55
56 AWS_EXTERN_C_END
57
58 #endif /* AWS_CHECKSUMS_PRIVATE_CRC64_PRIV_H */