diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 19:56:09 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 19:56:09 +0300 |
| commit | 7fb132859fda54aa96bc9dd46d302b343eeb5a02 (patch) | |
| tree | b43ae77d7451fb470a260c03349a1caf2846c5e5 /neozip/crc32_chorba_p.h | |
| parent | b1e34e861b5d732afe828d58aad2c638135061fd (diff) | |
| parent | c2712b8a345191f6ed79558c089777df94590087 (diff) | |
| download | Project-Tick-7fb132859fda54aa96bc9dd46d302b343eeb5a02.tar.gz Project-Tick-7fb132859fda54aa96bc9dd46d302b343eeb5a02.zip | |
Add 'neozip/' from commit 'c2712b8a345191f6ed79558c089777df94590087'
git-subtree-dir: neozip
git-subtree-mainline: b1e34e861b5d732afe828d58aad2c638135061fd
git-subtree-split: c2712b8a345191f6ed79558c089777df94590087
Diffstat (limited to 'neozip/crc32_chorba_p.h')
| -rw-r--r-- | neozip/crc32_chorba_p.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/neozip/crc32_chorba_p.h b/neozip/crc32_chorba_p.h new file mode 100644 index 0000000000..95f92af913 --- /dev/null +++ b/neozip/crc32_chorba_p.h @@ -0,0 +1,34 @@ +/* crc32_chorba_p.h -- crc32 chorba interface + * Copyright (C) 2021 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef CRC32_CHORBA_P_H_ +#define CRC32_CHORBA_P_H_ + +#include "zendian.h" + +/* Size thresholds for Chorba algorithm variants */ + +#define CHORBA_LARGE_THRESHOLD (sizeof(chorba_word_t) * 64 * 1024) +#define CHORBA_MEDIUM_UPPER_THRESHOLD 32768 +#define CHORBA_MEDIUM_LOWER_THRESHOLD 8192 +#define CHORBA_SMALL_THRESHOLD_64BIT 72 +#ifdef ARCH_64BIT +# define CHORBA_SMALL_THRESHOLD 72 +# define CHORBA_W 8 +# define CHORBA_WORD_FROM_LE(word) Z_U64_FROM_LE(word) + typedef uint64_t chorba_word_t; +#else +# define CHORBA_SMALL_THRESHOLD 80 +# define CHORBA_W 4 +# define CHORBA_WORD_FROM_LE(word) Z_U32_FROM_LE(word) + typedef uint32_t chorba_word_t; +#endif + +Z_INTERNAL uint32_t crc32_chorba_118960_nondestructive(uint32_t crc, const uint8_t *buf, size_t len); +Z_INTERNAL uint32_t crc32_chorba_32768_nondestructive(uint32_t crc, const uint8_t *buf, size_t len); +Z_INTERNAL uint32_t crc32_chorba_small_nondestructive(uint32_t crc, const uint8_t *buf, size_t len); +Z_INTERNAL uint32_t crc32_chorba_small_nondestructive_32bit(uint32_t crc, const uint8_t *buf, size_t len); + +#endif /* CRC32_CHORBA_P_H_ */ |
