From: Nathan Moinvaziri Date: Tue, 20 Jan 2026 01:06:02 +0000 (-0800) Subject: Use MIN macro in a few more instances throughout the code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d47d6c3c7aced39bae955010c383abb0d9e73b03;p=thirdparty%2Fzlib-ng.git Use MIN macro in a few more instances throughout the code --- diff --git a/arch/riscv/adler32_rvv.c b/arch/riscv/adler32_rvv.c index 4ea060009..8c297a617 100644 --- a/arch/riscv/adler32_rvv.c +++ b/arch/riscv/adler32_rvv.c @@ -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; diff --git a/gzread.c b/gzread.c index 3e321a03b..11273e415 100644 --- 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; diff --git a/test/infcover.c b/test/infcover.c index ba922dfcb..582feaebd 100644 --- a/test/infcover.c +++ b/test/infcover.c @@ -331,7 +331,7 @@ static void inf(char *hex, char *what, unsigned step, int win, unsigned len, int ret = PREFIX(inflateEnd)(©); 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);