Skip to content

Commit

Permalink
More build fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHenson committed Feb 5, 2024
1 parent 729bf32 commit 0ab865e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions include/aws/checksums/private/crc64_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ AWS_EXTERN_C_BEGIN

AWS_CHECKSUMS_API uint64_t aws_checksums_crc64xz_sw(const uint8_t *input, int length, uint64_t prev_crc64);

#if defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_CLMUL) && !(defined(_MSC_VER) && _MSC_VER < 1920)
#if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_CLMUL) && \
!(defined(_MSC_VER) && _MSC_VER < 1920)
uint64_t aws_checksums_crc64xz_intel_clmul(const uint8_t *input, int length, uint64_t previous_crc_64);
#endif /* defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_CLMUL) && !(defined(_MSC_VER) && _MSC_VER < 1920) */

#if defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_AVX2_INTRINSICS) && !(defined(_MSC_VER) && _MSC_VER < 1920)
#if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_AVX2_INTRINSICS) && \
!(defined(_MSC_VER) && _MSC_VER < 1920)
uint64_t aws_checksums_crc64xz_intel_avx512(const uint8_t *input, int length, uint64_t previous_crc_64);
#endif /* defined(AWS_ARCH_INTEL_X64) && defined(AWS_HAVE_AVX2_INTRINSICS) && !(defined(_MSC_VER) && _MSC_VER < 1920) \
*/

#if defined(AWS_ARCH_ARM64)
#if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_ARM64)
uint64_t aws_checksums_crc64xz_arm_pmull(const uint8_t *input, int length, uint64_t previous_crc_64);
#endif /* INTPTR_MAX == INT64_MAX && defined(AWS_HAVE_ARMv8_1) */

Expand Down
4 changes: 2 additions & 2 deletions include/aws/checksums/private/crc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ AWS_CHECKSUMS_API uint32_t aws_checksums_crc32_sw(const uint8_t *input, int leng
/* Computes the Castagnoli CRC32c (iSCSI) using a (slow) reference implementation. */
AWS_CHECKSUMS_API uint32_t aws_checksums_crc32c_sw(const uint8_t *input, int length, uint32_t previousCrc32c);

#if defined(AWS_ARCH_ARM64)
#if defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_ARM64)
uint32_t aws_checksums_crc32_armv8(const uint8_t *input, int length, uint32_t previous_crc32);
uint32_t aws_checksums_crc32c_armv8(const uint8_t *input, int length, uint32_t previous_crc32c);
#elif defined(AWS_ARCH_INTEL)
#elif defined(AWS_USE_CPU_EXTENSIONS) && defined(AWS_ARCH_INTEL)
# if defined(AWS_ARCH_INTEL_X64)
typedef uint64_t *slice_ptr_type;
typedef uint64_t slice_ptr_int_type;
Expand Down
7 changes: 4 additions & 3 deletions source/crc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ checksums_maxks_shifts_type aws_checksums_masks_shifts = {

AWS_ALIGNED_TYPEDEF(aws_checksums_crc64_constants_t, cheksums_constants, 16);

/* clang-format off */

// Pre-computed bit-reflected constants for CRC64XZ
// The actual exponents are reduced by 1 to compensate for bit-reflection (e.g. x^1024 is actually x^1023)
cheksums_constants aws_checksums_crc64xz_constants = {
/* clang-format off */

.x2048 =
{0x8260adf2381ad81c,
Expand Down Expand Up @@ -84,9 +85,9 @@ cheksums_constants aws_checksums_crc64xz_constants = {
{0xb91b6176fc36363f, 0xdda9f27ee08373ad}, // 13 trailing bytes: x^168 mod P(x) / x^104 mod P(x)
{0x4dcec64d2edf818c, 0x0dd9b4240837fd99}, // 14 trailing bytes: x^176 mod P(x) / x^112 mod P(x)
{0x4550ddde9a383296, 0xf075e4ae5e05bdff} // 15 trailing bytes: x^184 mod P(x) / x^120 mod P(x)
},
/* clang-format on */
}, //
};
/* clang-format on */

static uint64_t (*s_crc64xz_fn_ptr)(const uint8_t *input, int length, uint64_t prev_crc64) = 0;

Expand Down

0 comments on commit 0ab865e

Please sign in to comment.