Avoiding internal name conflict.

This commit is contained in:
Daniel Lemire 2021-04-07 13:39:07 -04:00
parent a8d49f40f0
commit 2cbfc21f8a

View File

@ -273,14 +273,14 @@ adjusted_mantissa compute_float(decimal &d) {
} }
static const uint32_t max_shift = 60; static const uint32_t max_shift = 60;
static const uint32_t num_powers = 19; static const uint32_t num_powers = 19;
static const uint8_t powers[19] = { static const uint8_t decimal_powers[19] = {
0, 3, 6, 9, 13, 16, 19, 23, 26, 29, // 0, 3, 6, 9, 13, 16, 19, 23, 26, 29, //
33, 36, 39, 43, 46, 49, 53, 56, 59, // 33, 36, 39, 43, 46, 49, 53, 56, 59, //
}; };
int32_t exp2 = 0; int32_t exp2 = 0;
while (d.decimal_point > 0) { while (d.decimal_point > 0) {
uint32_t n = uint32_t(d.decimal_point); uint32_t n = uint32_t(d.decimal_point);
uint32_t shift = (n < num_powers) ? powers[n] : max_shift; uint32_t shift = (n < num_powers) ? decimal_powers[n] : max_shift;
detail::decimal_right_shift(d, shift); detail::decimal_right_shift(d, shift);
if (d.decimal_point < -decimal_point_range) { if (d.decimal_point < -decimal_point_range) {
// should be zero // should be zero
@ -300,7 +300,7 @@ adjusted_mantissa compute_float(decimal &d) {
shift = (d.digits[0] < 2) ? 2 : 1; shift = (d.digits[0] < 2) ? 2 : 1;
} else { } else {
uint32_t n = uint32_t(-d.decimal_point); uint32_t n = uint32_t(-d.decimal_point);
shift = (n < num_powers) ? powers[n] : max_shift; shift = (n < num_powers) ? decimal_powers[n] : max_shift;
} }
detail::decimal_left_shift(d, shift); detail::decimal_left_shift(d, shift);
if (d.decimal_point > decimal_point_range) { if (d.decimal_point > decimal_point_range) {