The unified diff between revisions [0dc5b2d6..] and [b14c94b9..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'bn_mp_n_root.c'
#
#
# patch "bn_mp_n_root.c"
# from [339cf93663939605c6304419a020f33d4184b3dd]
# to [ceda8bdd58d2fb45707be024bc9ad46ceb44a337]
#
============================================================
--- bn_mp_n_root.c 339cf93663939605c6304419a020f33d4184b3dd
+++ bn_mp_n_root.c ceda8bdd58d2fb45707be024bc9ad46ceb44a337
@@ -40,11 +40,11 @@ int mp_n_root (mp_int * a, mp_digit b, m
}
if ((res = mp_init (&t2)) != MP_OKAY) {
- goto __T1;
+ goto LBL_T1;
}
if ((res = mp_init (&t3)) != MP_OKAY) {
- goto __T2;
+ goto LBL_T2;
}
/* if a is negative fudge the sign but keep track */
@@ -57,52 +57,52 @@ int mp_n_root (mp_int * a, mp_digit b, m
do {
/* t1 = t2 */
if ((res = mp_copy (&t2, &t1)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
/* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */
/* t3 = t1**(b-1) */
if ((res = mp_expt_d (&t1, b - 1, &t3)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
/* numerator */
/* t2 = t1**b */
if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
/* t2 = t1**b - a */
if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
/* denominator */
/* t3 = t1**(b-1) * b */
if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
/* t3 = (t1**b - a)/(b * t1**(b-1)) */
if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
} while (mp_cmp (&t1, &t2) != MP_EQ);
/* result can be off by a few so check */
for (;;) {
if ((res = mp_expt_d (&t1, b, &t2)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
if (mp_cmp (&t2, a) == MP_GT) {
if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) {
- goto __T3;
+ goto LBL_T3;
}
} else {
break;
@@ -120,9 +120,9 @@ int mp_n_root (mp_int * a, mp_digit b, m
res = MP_OKAY;
-__T3:mp_clear (&t3);
-__T2:mp_clear (&t2);
-__T1:mp_clear (&t1);
+LBL_T3:mp_clear (&t3);
+LBL_T2:mp_clear (&t2);
+LBL_T1:mp_clear (&t1);
return res;
}
#endif