Skip to content

Commit

Permalink
unbreak compilation: prevent name collision on pow10
Browse files Browse the repository at this point in the history
  • Loading branch information
chqrlie committed May 7, 2024
1 parent c31580b commit 3be1340
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions quickjs-printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3be1340

Please sign in to comment.