Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Sep 5, 2024
1 parent 9f99bdc commit 570bc06
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
26 changes: 12 additions & 14 deletions include/aws/checksums/private/crc_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
#include <aws/common/stdint.h>
#include <limits.h>

#define large_buffer_apply_impl(Name, T) \
T aws_large_buffer_apply_##Name(T (*checksum_fn)(const uint8_t *, int, T), \
const uint8_t *buffer, \
uint64_t length, \
T previous) { \
T val = previous; \
while (length > INT_MAX) { \
val = checksum_fn(buffer, INT_MAX, val); \
buffer += (size_t)INT_MAX; \
length -= (uint64_t)INT_MAX; \
} \
val = checksum_fn(buffer, (int)length, val); \
return val; \
} \
#define large_buffer_apply_impl(Name, T) \
T aws_large_buffer_apply_##Name( \
T (*checksum_fn)(const uint8_t *, int, T), const uint8_t *buffer, uint64_t length, T previous) { \
T val = previous; \
while (length > INT_MAX) { \
val = checksum_fn(buffer, INT_MAX, val); \
buffer += (size_t)INT_MAX; \
length -= (uint64_t)INT_MAX; \
} \
val = checksum_fn(buffer, (int)length, val); \
return val; \
}

#endif /* AWS_CHECKSUMS_PRIVATE_CRC_UTIL_H */
2 changes: 1 addition & 1 deletion source/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

large_buffer_apply_impl(crc32, uint32_t)

static uint32_t (*s_crc32c_fn_ptr)(const uint8_t *input, int length, uint32_t previous_crc32c) = 0;
static uint32_t (*s_crc32c_fn_ptr)(const uint8_t *input, int length, uint32_t previous_crc32c) = 0;
static uint32_t (*s_crc32_fn_ptr)(const uint8_t *input, int length, uint32_t previous_crc32) = 0;

uint32_t aws_checksums_crc32(const uint8_t *input, int length, uint32_t previous_crc32) {
Expand Down
2 changes: 1 addition & 1 deletion source/crc64.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

large_buffer_apply_impl(crc64, uint64_t)

AWS_ALIGNED_TYPEDEF(uint8_t, checksums_maxks_shifts_type[6][16], 16);
AWS_ALIGNED_TYPEDEF(uint8_t, checksums_maxks_shifts_type[6][16], 16);
// Intel PSHUFB / ARM VTBL patterns for left/right shifts and masks
checksums_maxks_shifts_type aws_checksums_masks_shifts = {
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, //
Expand Down
1 change: 0 additions & 1 deletion tests/crc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ static int s_test_crc32(struct aws_allocator *allocator, void *ctx) {
}
AWS_TEST_CASE(test_crc32, s_test_crc32)


static int s_test_large_buffer_crc32(struct aws_allocator *allocator, void *ctx) {
(void)ctx;
#if SIZE_BITS == 32
Expand Down

0 comments on commit 570bc06

Please sign in to comment.