Skip to content

Commit 1c9199d

Browse files
committed
Address comments
1 parent 56a9028 commit 1c9199d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/bcmath/libbcmath/src/convert.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ static inline BC_VECTOR bc_partial_convert_to_vector(const char *n, size_t len)
3434
}
3535

3636
BC_VECTOR num = 0;
37-
BC_VECTOR base = 1;
37+
BC_VECTOR digit_base_value = 1;
3838

3939
for (size_t i = 0; i < len; i++) {
40-
num += *n * base;
41-
base *= BASE;
40+
num += *n * digit_base_value;
41+
digit_base_value *= BASE;
4242
n--;
4343
}
4444

@@ -67,15 +67,15 @@ static inline void bc_convert_to_vector_with_zero_pad(BC_VECTOR *n_vector, const
6767

6868
if (zeros > 0) {
6969
*n_vector = 0;
70-
BC_VECTOR base = BC_POW_10_LUT[zeros];
71-
size_t tmp_len = MIN(BC_VECTOR_SIZE - zeros, nlen);
72-
for (size_t i = 0; i < tmp_len; i++) {
73-
*n_vector += *nend * base;
74-
base *= BASE;
70+
BC_VECTOR digit_base_value = BC_POW_10_LUT[zeros];
71+
size_t len_to_write = MIN(BC_VECTOR_SIZE - zeros, nlen);
72+
for (size_t i = 0; i < len_to_write; i++) {
73+
*n_vector += *nend * digit_base_value;
74+
digit_base_value *= BASE;
7575
nend--;
7676
}
7777
n_vector++;
78-
nlen -= tmp_len;
78+
nlen -= len_to_write;
7979
}
8080

8181
if (nlen == 0) {

0 commit comments

Comments
 (0)