]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Use fixed width types in compare256 definition.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 22 Jan 2022 17:17:19 +0000 (09:17 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 23 Jan 2022 15:39:48 +0000 (16:39 +0100)
arch/x86/compare256_avx2.c
arch/x86/compare256_sse42.c
compare256.c
cpu_features.h
functable.c
functable.h
test/benchmarks/benchmark_compare256.cc

index 253976b5bfef1a33394100a1f7bccdec62931378..fd9481bfdef6c629a5112e6996a0389c5d76f7ec 100644 (file)
@@ -16,7 +16,7 @@
 #endif
 
 /* UNALIGNED_OK, AVX2 intrinsic comparison */
-static inline uint32_t compare256_unaligned_avx2_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_unaligned_avx2_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -47,7 +47,7 @@ static inline uint32_t compare256_unaligned_avx2_static(const unsigned char *src
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_unaligned_avx2(const uint8_t *src0, const uint8_t *src1) {
     return compare256_unaligned_avx2_static(src0, src1);
 }
 
index 3e5f150566f9732c8a6dddc6653facad42a19090..5f30b5e3ed9622a323eef88cc0925db90b73ed23 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 /* UNALIGNED_OK, SSE4.2 intrinsic comparison */
-static inline uint32_t compare256_unaligned_sse4_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_unaligned_sse4_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -54,7 +54,7 @@ static inline uint32_t compare256_unaligned_sse4_static(const unsigned char *src
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_unaligned_sse4(const uint8_t *src0, const uint8_t *src1) {
     return compare256_unaligned_sse4_static(src0, src1);
 }
 
index 20d967e8bde1e3f7f1d81fad35f34a73a63bade2..415088c5f14219539dcbdb714ad38bf7ea9677d4 100644 (file)
@@ -9,7 +9,7 @@
 #include "fallback_builtins.h"
 
 /* ALIGNED, byte comparison */
-static inline uint32_t compare256_c_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_c_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -42,7 +42,7 @@ static inline uint32_t compare256_c_static(const unsigned char *src0, const unsi
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_c(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) {
     return compare256_c_static(src0, src1);
 }
 
@@ -59,7 +59,7 @@ Z_INTERNAL uint32_t compare256_c(const unsigned char *src0, const unsigned char
 
 #ifdef UNALIGNED_OK
 /* UNALIGNED_OK, 16-bit integer comparison */
-static inline uint32_t compare256_unaligned_16_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_unaligned_16_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -80,7 +80,7 @@ static inline uint32_t compare256_unaligned_16_static(const unsigned char *src0,
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_unaligned_16(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1) {
     return compare256_unaligned_16_static(src0, src1);
 }
 
@@ -97,7 +97,7 @@ Z_INTERNAL uint32_t compare256_unaligned_16(const unsigned char *src0, const uns
 
 #ifdef HAVE_BUILTIN_CTZ
 /* UNALIGNED_OK, 32-bit integer comparison */
-static inline uint32_t compare256_unaligned_32_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_unaligned_32_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -118,7 +118,7 @@ static inline uint32_t compare256_unaligned_32_static(const unsigned char *src0,
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_unaligned_32(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1) {
     return compare256_unaligned_32_static(src0, src1);
 }
 
@@ -137,7 +137,7 @@ Z_INTERNAL uint32_t compare256_unaligned_32(const unsigned char *src0, const uns
 
 #if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL)
 /* UNALIGNED64_OK, 64-bit integer comparison */
-static inline uint32_t compare256_unaligned_64_static(const unsigned char *src0, const unsigned char *src1) {
+static inline uint32_t compare256_unaligned_64_static(const uint8_t *src0, const uint8_t *src1) {
     uint32_t len = 0;
 
     do {
@@ -158,7 +158,7 @@ static inline uint32_t compare256_unaligned_64_static(const unsigned char *src0,
     return 256;
 }
 
-Z_INTERNAL uint32_t compare256_unaligned_64(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1) {
     return compare256_unaligned_64_static(src0, src1);
 }
 
index 4cd1ed7b26203f8b95ec62841dd013ace79ad343..103356b3e6d51b2ae2e6a61adc8370126c37b881 100644 (file)
@@ -140,18 +140,18 @@ extern uint32_t s390_crc32_vx(uint32_t crc, const unsigned char *buf, uint64_t l
 #endif
 
 /* compare256 */
-extern uint32_t compare256_c(const unsigned char *src0, const unsigned char *src1);
+extern uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1);
 #ifdef UNALIGNED_OK
-extern uint32_t compare256_unaligned_16(const unsigned char *src0, const unsigned char *src1);
-extern uint32_t compare256_unaligned_32(const unsigned char *src0, const unsigned char *src1);
+extern uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1);
+extern uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1);
 #ifdef UNALIGNED64_OK
-extern uint32_t compare256_unaligned_64(const unsigned char *src0, const unsigned char *src1);
+extern uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1);
 #endif
 #ifdef X86_SSE42_CMP_STR
-extern uint32_t compare256_unaligned_sse4(const unsigned char *src0, const unsigned char *src1);
+extern uint32_t compare256_unaligned_sse4(const uint8_t *src0, const uint8_t *src1);
 #endif
 #if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ)
-extern uint32_t compare256_unaligned_avx2(const unsigned char *src0, const unsigned char *src1);
+extern uint32_t compare256_unaligned_avx2(const uint8_t *src0, const uint8_t *src1);
 #endif
 #endif
 
index 6e9563bcc47c10dd007eeadb6c0ea78962e67ed9..edcbba05d603b6d82a8eac8a06f9aa4725a466bc 100644 (file)
@@ -348,7 +348,7 @@ Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t
     return functable.crc32(crc, buf, len);
 }
 
-Z_INTERNAL uint32_t compare256_stub(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL uint32_t compare256_stub(const uint8_t *src0, const uint8_t *src1) {
 
 #ifdef UNALIGNED_OK
 #  if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL)
index f029ed4d133661ac531ebaa147b1c345a2082467..277e34a24a19d7b71fd81fc9ea17b2b166f6f5a9 100644 (file)
@@ -19,7 +19,7 @@ struct functable_s {
     void     (* crc32_fold_copy)    (crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len);
     uint32_t (* crc32_fold_final)   (crc32_fold *crc);
     void     (* slide_hash)         (deflate_state *s);
-    uint32_t (* compare256)         (const unsigned char *src0, const unsigned char *src1);
+    uint32_t (* compare256)         (const uint8_t *src0, const uint8_t *src1);
     uint32_t (* longest_match)      (deflate_state *const s, Pos cur_match);
     uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
     uint32_t (* chunksize)          (void);
index 063d110fa069723901998b77fa49eccbfc866b33..a420398d9735ce388843d430f2c27fa0ef057b5c 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
 
 #define MAX_COMPARE_SIZE (256)
 
-typedef uint32_t (*compare256_func)(const unsigned char *src0, const unsigned char *src1);
+typedef uint32_t (*compare256_func)(const uint8_t *src0, const uint8_t *src1);
 
 class compare256: public benchmark::Fixture {
 private: