]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove deflate_state parameter from update_hash functions.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 27 Jan 2024 23:50:54 +0000 (15:50 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 23 Feb 2024 12:34:10 +0000 (13:34 +0100)
arch/arm/arm_functions.h
arch/x86/x86_functions.h
deflate.c
deflate.h
functable.c
functable.h
insert_string_tpl.h
match_tpl.h

index bf867e93cc773e9e6d9fc571d4700063d065880e..711a9f627be7ad30b6d54690da4a5c082c4cad48 100644 (file)
@@ -25,7 +25,7 @@ uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len);
 
 void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count);
 Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str);
-uint32_t update_hash_acle(deflate_state *const s, uint32_t h, uint32_t val);
+uint32_t update_hash_acle(uint32_t h, uint32_t val);
 #endif
 
 #ifdef ARM_SIMD
index 5807c96600574f95bf6897ebeb6cc47542e16ad9..a93a44b10121c6d82c4d17df2e0b4e84c43e4849 100644 (file)
@@ -29,7 +29,7 @@ void inflate_fast_ssse3(PREFIX3(stream) *strm, uint32_t start);
 uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len);
 void insert_string_sse42(deflate_state *const s, const uint32_t str, uint32_t count);
 Pos quick_insert_string_sse42(deflate_state *const s, const uint32_t str);
-uint32_t update_hash_sse42(deflate_state *const s, uint32_t h, uint32_t val);
+uint32_t update_hash_sse42(uint32_t h, uint32_t val);
 #endif
 
 #ifdef X86_AVX2
index 81cc5b09df7615e86c42542ec7957aa3af5fc4ba..110830ef2869f3f5db6d229a13151bf36f8b5830 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -120,7 +120,7 @@ static void lm_set_level         (deflate_state *s, int level);
 static void lm_init              (deflate_state *s);
 Z_INTERNAL unsigned read_buf  (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
 
-extern uint32_t update_hash_roll        (deflate_state *const s, uint32_t h, uint32_t val);
+extern uint32_t update_hash_roll        (uint32_t h, uint32_t val);
 extern void     insert_string_roll      (deflate_state *const s, uint32_t str, uint32_t count);
 extern Pos      quick_insert_string_roll(deflate_state *const s, uint32_t str);
 
@@ -1236,7 +1236,7 @@ void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
         if (s->lookahead + s->insert >= STD_MIN_MATCH) {
             unsigned int str = s->strstart - s->insert;
             if (UNLIKELY(s->max_chain_length > 1024)) {
-                s->ins_h = s->update_hash(s, s->window[str], s->window[str+1]);
+                s->ins_h = s->update_hash(s->window[str], s->window[str+1]);
             } else if (str >= 1) {
                 s->quick_insert_string(s, str + 2 - STD_MIN_MATCH);
             }
index b96ee0724c5539c32b03f071645a18fd99626fab..498b161b567a7dff57d577a4d2b6bc192d01cae3 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -113,7 +113,7 @@ typedef uint16_t Pos;
 /* Type definitions for hash callbacks */
 typedef struct internal_state deflate_state;
 
-typedef uint32_t (* update_hash_cb)        (deflate_state *const s, uint32_t h, uint32_t val);
+typedef uint32_t (* update_hash_cb)        (uint32_t h, uint32_t val);
 typedef void     (* insert_string_cb)      (deflate_state *const s, uint32_t str, uint32_t count);
 typedef Pos      (* quick_insert_string_cb)(deflate_state *const s, uint32_t str);
 
index ebbd3ac3c85c7563f4284ab90f6929cdf6cd45fc..f54d7077abf2ff36c6d93062cb0df561dec74988 100644 (file)
@@ -352,9 +352,9 @@ static void slide_hash_stub(deflate_state* s) {
     functable.slide_hash(s);
 }
 
-static uint32_t update_hash_stub(deflate_state* const s, uint32_t h, uint32_t val) {
+static uint32_t update_hash_stub(uint32_t h, uint32_t val) {
     init_functable();
-    return functable.update_hash(s, h, val);
+    return functable.update_hash(h, val);
 }
 
 /* functable init */
index 21021770cdbfdeb69bcad62d60f5751173cbd636..201d45f991a98fca8d55a0d9c01828ad08cc93f3 100644 (file)
@@ -27,7 +27,7 @@ struct functable_s {
     uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
     Pos      (* quick_insert_string)(deflate_state *const s, uint32_t str);
     void     (* slide_hash)         (deflate_state *s);
-    uint32_t (* update_hash)        (deflate_state *const s, uint32_t h, uint32_t val);
+    uint32_t (* update_hash)        (uint32_t h, uint32_t val);
 };
 
 Z_INTERNAL extern struct functable_s functable;
index a4b0c4a515c3ca623bcdf7730d91e466a19fb45f..bfadc5de9e454c4cb01a2360716a1e44833846c2 100644 (file)
@@ -47,8 +47,7 @@
  *    input characters, so that a running hash key can be computed from the
  *    previous key instead of complete recalculation each time.
  */
-Z_INTERNAL uint32_t UPDATE_HASH(deflate_state *const s, uint32_t h, uint32_t val) {
-    (void)s;
+Z_INTERNAL uint32_t UPDATE_HASH(uint32_t h, uint32_t val) {
     HASH_CALC(s, h, val);
     return h & HASH_CALC_MASK;
 }
index d32c29d7661ca6aa0c63a223cfe3d97b97a736d0..9c258242cd7640bc6c1eabcb6287a622357eb45c 100644 (file)
@@ -102,11 +102,11 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
          * to cur_match). We cannot use s->prev[strstart+1,...] immediately, because
          * these strings are not yet inserted into the hash table.
          */
-        hash = s->update_hash(s, 0, scan[1]);
-        hash = s->update_hash(s, hash, scan[2]);
+        hash = s->update_hash(0, scan[1]);
+        hash = s->update_hash(hash, scan[2]);
 
         for (i = 3; i <= best_len; i++) {
-            hash = s->update_hash(s, hash, scan[i]);
+            hash = s->update_hash(hash, scan[i]);
 
             /* If we're starting with best_len >= 3, we can use offset search. */
             pos = s->head[hash];
@@ -236,9 +236,9 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
                  */
                 scan_endstr = scan + len - (STD_MIN_MATCH+1);
 
-                hash = s->update_hash(s, 0, scan_endstr[0]);
-                hash = s->update_hash(s, hash, scan_endstr[1]);
-                hash = s->update_hash(s, hash, scan_endstr[2]);
+                hash = s->update_hash(0, scan_endstr[0]);
+                hash = s->update_hash(hash, scan_endstr[1]);
+                hash = s->update_hash(hash, scan_endstr[2]);
 
                 pos = s->head[hash];
                 if (pos < cur_match) {