]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Use MIN macro in a few more instances throughout the code
authorNathan Moinvaziri <nathan@nathanm.com>
Tue, 20 Jan 2026 01:06:02 +0000 (17:06 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 24 Jan 2026 14:22:09 +0000 (15:22 +0100)
arch/riscv/adler32_rvv.c
gzread.c
test/infcover.c

index 4ea060009bd04f4428c7e3f751e1e3aff637aa36..8c297a617bd3a4a2a2ace47cff8b2213b5427c1c 100644 (file)
@@ -26,7 +26,7 @@ Z_FORCEINLINE static uint32_t adler32_copy_impl(uint32_t adler, uint8_t* restric
 
     size_t left = len;
     size_t vl = __riscv_vsetvlmax_e8m1();
-    vl = vl > 256 ? 256 : vl;
+    vl = MIN(vl, 256);
     vuint32m4_t v_buf32_accu = __riscv_vmv_v_x_u32m4(0, vl);
     vuint32m4_t v_adler32_prev_accu = __riscv_vmv_v_x_u32m4(0, vl);
     vuint16m2_t v_buf16_accu;
index 3e321a03bab64aa15f6ed811aeeca1720f63a651..11273e415c0e8aa3a142a62c406f3e1c37eca226 100644 (file)
--- a/gzread.c
+++ b/gzread.c
@@ -537,7 +537,7 @@ char * Z_EXPORT PREFIX(gzgets)(gzFile file, char *buf, z_int32_t len) {
             }
 
             /* look for end-of-line in current output buffer */
-            n = state->x.have > left ? left : state->x.have;
+            n = MIN(state->x.have, left);
             eol = (unsigned char *)memchr(state->x.next, '\n', n);
             if (eol != NULL)
                 n = (unsigned)(eol - state->x.next) + 1;
index ba922dfcb3696133653748ad9920660ddc6af759..582feaebd6ee3a437846c850c4d0ad55b18bb6f8 100644 (file)
@@ -331,7 +331,7 @@ static void inf(char *hex, char *what, unsigned step, int win, unsigned len, int
         ret = PREFIX(inflateEnd)(&copy);        assert(ret == Z_OK);
         err = 9;                        /* don't care next time around */
         have += strm.avail_in;
-        strm.avail_in = step > have ? have : step;
+        strm.avail_in = MIN(step, have);
         have -= strm.avail_in;
     } while (strm.avail_in);
     free(in);