From 3be134045fee1dd9e54858cbd2cb86f8a3756aff Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Wed, 8 May 2024 00:42:19 +0200 Subject: [PATCH] unbreak compilation: prevent name collision on pow10 --- quickjs-printf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quickjs-printf.c b/quickjs-printf.c index 035b966b..e2e64caf 100644 --- a/quickjs-printf.c +++ b/quickjs-printf.c @@ -158,7 +158,7 @@ static int digits_count(uint32_t val) { } /* Powers of 5 less than UINT32_MAX */ -static uint32_t const pow5[14] = { +static uint32_t const pow5_table[14] = { 1UL, 5UL, 5UL*5UL, @@ -176,7 +176,7 @@ static uint32_t const pow5[14] = { }; /* Powers of 10 less than UINT32_MAX */ -static uint32_t const pow10[10] = { +static uint32_t const pow10_table[10] = { 1UL, 10UL, 100UL, @@ -266,7 +266,7 @@ static int js_format_f(double value, char dest[minimum_length(2+1074+1)], plen = comp10_init(digits, mant); for (exp = -exp2; exp > 0;) { int k = exp >= 13 ? 13 : exp; - plen = comp10_multiply(digits, plen, pow5[k]); + plen = comp10_multiply(digits, plen, pow5_table[k]); exp -= k; } } @@ -309,7 +309,7 @@ static int js_format_f(double value, char dest[minimum_length(2+1074+1)], trail |= digits[start++]; trunc -= COMP10_LEN; } - inc = pow10[trunc]; // trunc is in range 1..COMP10_LEN + inc = pow10_table[trunc]; // trunc is in range 1..COMP10_LEN half = inc / 2; low = digits[start] % inc; // round to nearest, tie to even