Skip to content

Commit 8552e72

Browse files
committed
build: avoid MIN macro for Windows
1 parent aa00b1d commit 8552e72

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mz_strm_ppmd.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
See the accompanying LICENSE file for the full text of the license.
99
*/
1010

11-
#include <sys/param.h> // for MIN()
1211
#include <assert.h>
1312

1413
#include "mz.h"
@@ -186,7 +185,7 @@ int32_t mz_stream_ppmd_open(void *stream, const char *path, int32_t mode) {
186185
return MZ_SUPPORT_ERROR;
187186
#else
188187
/* PPMD8_MIN_ORDER (= 2) <= order <= PPMD8_MAX_ORDER (= 16)
189-
* 1MB (= 2* 0) <= memSize <= 256MB (= 2^ 8) (M = 2^ 20)
188+
* 2MB (= 2^ 1) <= memSize <= 128MB (= 2^ 7) (M = 2^ 20)
190189
* restor = 0 (PPMD8_RESTORE_METHOD_RESTART),
191190
* 1 (PPMD8_RESTORE_METHOD_CUT_OFF)
192191
*
@@ -198,19 +197,19 @@ int32_t mz_stream_ppmd_open(void *stream, const char *path, int32_t mode) {
198197
*/
199198

200199
/* PPMd parameters. */
201-
unsigned order;
200+
unsigned order = ppmd->preset; /* 2, 3, ..., 16. */
202201
uint32_t mem_size;
203202
unsigned restor;
204203
uint16_t ppmd_param_word;
205204

206-
if (ppmd->preset < PPMD8_MIN_ORDER || ppmd->preset > PPMD8_MAX_ORDER)
205+
if (order < PPMD8_MIN_ORDER || order > PPMD8_MAX_ORDER)
207206
return MZ_OPEN_ERROR;
208207

209208
mz_setup_buffered_writer(ppmd);
210209

211-
order = ppmd->preset; /* 4, 5, 6, ..., 12. */
212-
mem_size = 1 << (MIN(ppmd->preset, 8) - 1); /* 1MB, 2MB, 4MB, ..., 128MB. */
213-
restor = (ppmd->preset <= 6 ? 0 : 1);
210+
mem_size = 1 << ((order < 8 ? order : 8) - 1); /* 2MB, 4MB, ..., 128MB. */
211+
212+
restor = (order <= 6 ? 0 : 1);
214213

215214
mem_size <<= 20; /* Convert B to MB. */
216215

0 commit comments

Comments
 (0)