aboutsummaryrefslogtreecommitdiff
path: root/c/tools/brotli.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/tools/brotli.c')
-rw-r--r--c/tools/brotli.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/c/tools/brotli.c b/c/tools/brotli.c
index ea4fdac..ce05b64 100644
--- a/c/tools/brotli.c
+++ b/c/tools/brotli.c
@@ -943,10 +943,9 @@ static BROTLI_BOOL CompressFiles(Context* context) {
uint32_t lgwin = DEFAULT_LGWIN;
/* Use file size to limit lgwin. */
if (context->input_file_length >= 0) {
- int32_t size = 1 << BROTLI_MIN_WINDOW_BITS;
lgwin = BROTLI_MIN_WINDOW_BITS;
- while (size < context->input_file_length) {
- size <<= 1;
+ while (BROTLI_MAX_BACKWARD_LIMIT(lgwin) <
+ (uint64_t)context->input_file_length) {
lgwin++;
if (lgwin == BROTLI_MAX_WINDOW_BITS) break;
}