summaryrefslogtreecommitdiff
path: root/neozip/crc32_braid_p.h
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 19:56:09 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 19:56:09 +0300
commit7fb132859fda54aa96bc9dd46d302b343eeb5a02 (patch)
treeb43ae77d7451fb470a260c03349a1caf2846c5e5 /neozip/crc32_braid_p.h
parentb1e34e861b5d732afe828d58aad2c638135061fd (diff)
parentc2712b8a345191f6ed79558c089777df94590087 (diff)
downloadProject-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_braid_p.h')
-rw-r--r--neozip/crc32_braid_p.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/neozip/crc32_braid_p.h b/neozip/crc32_braid_p.h
new file mode 100644
index 0000000000..624e22ecd9
--- /dev/null
+++ b/neozip/crc32_braid_p.h
@@ -0,0 +1,36 @@
+#ifndef CRC32_BRAID_P_H_
+#define CRC32_BRAID_P_H_
+
+#include "zendian.h"
+
+/* Define BRAID_N, valid range is 1..6 */
+#define BRAID_N 5
+
+/* Define BRAID_W and the associated z_word_t type. If BRAID_W is not defined, then a braided
+ calculation is not used, and the associated tables and code are not compiled.
+
+ TODO: According to crc32_braid_c.c, BRAID_N=5, BRAID_W=4 is fastest with Sparc64-VII,
+ PowerPC POWER9, and MIPS64 Octeon II processors.
+ */
+#ifdef ARCH_64BIT
+# define BRAID_W 8
+ typedef uint64_t z_word_t;
+# define Z_WORD_FROM_LE(word) Z_U64_FROM_LE(word)
+#else
+# define BRAID_W 4
+ typedef uint32_t z_word_t;
+# define Z_WORD_FROM_LE(word) Z_U32_FROM_LE(word)
+#endif
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+# define BRAID_TABLE crc_braid_table
+#elif BYTE_ORDER == BIG_ENDIAN
+# define BRAID_TABLE crc_braid_big_table
+#else
+# error "No endian defined"
+#endif
+
+/* CRC polynomial. */
+#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
+
+#endif /* CRC32_BRAID_P_H_ */