bary_mul_karatsuba_branch: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
This commit is contained in:
parent
e634a9d1a5
commit
4dfc2f2e3d
Notes:
git
2020-06-29 11:07:16 +09:00
16
bignum.c
16
bignum.c
@ -2469,12 +2469,7 @@ bary_mul_karatsuba_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn,
|
|||||||
{
|
{
|
||||||
/* normal multiplication when x is small */
|
/* normal multiplication when x is small */
|
||||||
if (xn < KARATSUBA_MUL_DIGITS) {
|
if (xn < KARATSUBA_MUL_DIGITS) {
|
||||||
normal:
|
goto normal;
|
||||||
if (xds == yds && xn == yn)
|
|
||||||
bary_sq_fast(zds, zn, xds, xn);
|
|
||||||
else
|
|
||||||
bary_short_mul(zds, zn, xds, xn, yds, yn);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* normal multiplication when x or y is a sparse bignum */
|
/* normal multiplication when x or y is a sparse bignum */
|
||||||
@ -2492,6 +2487,15 @@ bary_mul_karatsuba_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn,
|
|||||||
|
|
||||||
/* multiplication by karatsuba method */
|
/* multiplication by karatsuba method */
|
||||||
bary_mul_karatsuba(zds, zn, xds, xn, yds, yn, wds, wn);
|
bary_mul_karatsuba(zds, zn, xds, xn, yds, yn, wds, wn);
|
||||||
|
return;
|
||||||
|
|
||||||
|
normal:
|
||||||
|
if (xds == yds && xn == yn) {
|
||||||
|
bary_sq_fast(zds, zn, xds, xn);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bary_short_mul(zds, zn, xds, xn, yds, yn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user