Skip to content

Commit 7f8ce48

Browse files
committed
Rename variable to appease testme.sh
1 parent f86abd2 commit 7f8ce48

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

bn_mp_todecimal_fast.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
/* SPDX-License-Identifier: Unlicense */
66

77
/* store a bignum as a decimal ASCII string */
8-
mp_err mp_todecimal_fast_rec(mp_int *number, mp_int *nL, mp_int *shiftL, mp_int *mL, int index, int left, char **result) {
8+
mp_err mp_todecimal_fast_rec(mp_int *number, mp_int *nL, mp_int *shiftL, mp_int *mL, int precalc_array_index, int left, char **result) {
99
mp_int q, nLq, r;
1010
mp_err err;
1111

12-
if (index < 0) {
12+
if (precalc_array_index < 0) {
1313
char *next_piece = calloc(4, sizeof(char));
1414
int s_s = left ? snprintf(next_piece, 4, "%u", mp_get_u32(number)) : snprintf(next_piece, 4, "%03u", mp_get_u32(number));
1515
size_t r_s = strlen(*result);
@@ -21,14 +21,14 @@ mp_err mp_todecimal_fast_rec(mp_int *number, mp_int *nL, mp_int *shiftL, mp_int
2121
if ((err = mp_init_multi(&q, &nLq, &r, NULL)) != MP_OKAY) {
2222
goto LBL_ERR;
2323
}
24-
if ((err = mp_mul(number, &mL[index], &q)) != MP_OKAY) {
24+
if ((err = mp_mul(number, &mL[precalc_array_index], &q)) != MP_OKAY) {
2525
goto LBL_ERR;
2626
}
27-
if ((err = mp_div_2d(&q, mp_get_u32(&shiftL[index]), &q, NULL)) != MP_OKAY) {
27+
if ((err = mp_div_2d(&q, mp_get_u32(&shiftL[precalc_array_index]), &q, NULL)) != MP_OKAY) {
2828
goto LBL_ERR;
2929
}
3030

31-
if ((err = mp_mul(&nL[index], &q, &nLq)) != MP_OKAY) {
31+
if ((err = mp_mul(&nL[precalc_array_index], &q, &nLq)) != MP_OKAY) {
3232
goto LBL_ERR;
3333
}
3434

@@ -40,21 +40,21 @@ mp_err mp_todecimal_fast_rec(mp_int *number, mp_int *nL, mp_int *shiftL, mp_int
4040
if ((err = mp_sub_d(&q, 1, &q)) != MP_OKAY) {
4141
goto LBL_ERR;
4242
}
43-
if ((err = mp_add(&r, &nL[index], &r)) != MP_OKAY) {
43+
if ((err = mp_add(&r, &nL[precalc_array_index], &r)) != MP_OKAY) {
4444
goto LBL_ERR;
4545
}
4646
}
4747

48-
--index;
48+
--precalc_array_index;
4949
if (left && mp_iszero(&q)) {
50-
if ((err = mp_todecimal_fast_rec(&r, nL, shiftL, mL, index, 1, result)) != MP_OKAY) {
50+
if ((err = mp_todecimal_fast_rec(&r, nL, shiftL, mL, precalc_array_index, 1, result)) != MP_OKAY) {
5151
goto LBL_ERR;
5252
}
5353
} else {
54-
if ((err = mp_todecimal_fast_rec(&q, nL, shiftL, mL, index, left, result)) != MP_OKAY) {
54+
if ((err = mp_todecimal_fast_rec(&q, nL, shiftL, mL, precalc_array_index, left, result)) != MP_OKAY) {
5555
goto LBL_ERR;
5656
}
57-
if ((err = mp_todecimal_fast_rec(&r, nL, shiftL, mL, index, 0, result)) != MP_OKAY) {
57+
if ((err = mp_todecimal_fast_rec(&r, nL, shiftL, mL, precalc_array_index, 0, result)) != MP_OKAY) {
5858
goto LBL_ERR;
5959
}
6060
}
@@ -70,7 +70,7 @@ mp_err mp_todecimal_fast(mp_int *number, char **result) {
7070
mp_int n, shift, M, M2, M22, M4, M44;
7171
mp_int *nL, *shiftL, *mL;
7272
mp_err err;
73-
int index = 1;
73+
int precalc_array_index = 1;
7474

7575
if ((err = mp_init_multi(&M2, &M22, &M4, &M44, NULL)) != MP_OKAY) {
7676
goto LBL_ERR;
@@ -159,10 +159,10 @@ mp_err mp_todecimal_fast(mp_int *number, char **result) {
159159
}
160160
}
161161

162-
if ((err = mp_init_copy(&nL[index], &n)) != MP_OKAY) {
162+
if ((err = mp_init_copy(&nL[precalc_array_index], &n)) != MP_OKAY) {
163163
goto LBL_ERR;
164164
}
165-
if ((err = mp_init_copy(&shiftL[index], &shift)) != MP_OKAY) {
165+
if ((err = mp_init_copy(&shiftL[precalc_array_index], &shift)) != MP_OKAY) {
166166
goto LBL_ERR;
167167
}
168168

@@ -181,13 +181,13 @@ mp_err mp_todecimal_fast(mp_int *number, char **result) {
181181
goto LBL_ERR;
182182
}
183183
}
184-
if ((err = mp_init_copy(&mL[index], &M4)) != MP_OKAY) {
184+
if ((err = mp_init_copy(&mL[precalc_array_index], &M4)) != MP_OKAY) {
185185
goto LBL_ERR;
186186
}
187-
index++;
187+
precalc_array_index++;
188188
}
189189

190-
if ((err = mp_todecimal_fast_rec(number, nL, shiftL, mL, index - 1, 1, result)) != MP_OKAY) {
190+
if ((err = mp_todecimal_fast_rec(number, nL, shiftL, mL, precalc_array_index - 1, 1, result)) != MP_OKAY) {
191191
goto LBL_ERR;
192192
}
193193

0 commit comments

Comments
 (0)