X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnormal.cpp;h=2bb3a4300c92b4976d7204a6ab49f5ecee636464;hp=5d044fc6f40f6da06a6aaff3b12c670115cd7c3a;hb=adb1dbd383ae6e5a999b5f8cba72a5c2bfd50c11;hpb=c77689e7ac8d8f4dbca0f337b6e9acf2419010ff diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 5d044fc6..2bb3a430 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -1746,45 +1746,29 @@ static ex gcd_pf_pow(const ex& a, const ex& b, ex* ca, ex* cb, bool check_args) static ex gcd_pf_mul(const ex& a, const ex& b, ex* ca, ex* cb, bool check_args) { - if (is_exactly_a(a)) { - if (is_exactly_a(b) && b.nops() > a.nops()) - goto factored_b; -factored_a: - size_t num = a.nops(); - exvector g; g.reserve(num); - exvector acc_ca; acc_ca.reserve(num); - ex part_b = b; - for (size_t i=0; isetflag(status_flags::dynallocated); - if (cb) - *cb = part_b; - return (new mul(g))->setflag(status_flags::dynallocated); - } else if (is_exactly_a(b)) { - if (is_exactly_a(a) && a.nops() > b.nops()) - goto factored_a; -factored_b: - size_t num = b.nops(); - exvector g; g.reserve(num); - exvector acc_cb; acc_cb.reserve(num); - ex part_a = a; - for (size_t i=0; isetflag(status_flags::dynallocated); - return (new mul(g))->setflag(status_flags::dynallocated); - } + if (is_exactly_a(a) && is_exactly_a(b) + && (b.nops() > a.nops())) + return gcd_pf_mul(b, a, cb, ca, check_args); + + if (is_exactly_a(b) && (!is_exactly_a(a))) + return gcd_pf_mul(b, a, cb, ca, check_args); + + GINAC_ASSERT(is_exactly_a(a)); + size_t num = a.nops(); + exvector g; g.reserve(num); + exvector acc_ca; acc_ca.reserve(num); + ex part_b = b; + for (size_t i=0; isetflag(status_flags::dynallocated); + if (cb) + *cb = part_b; + return (new mul(g))->setflag(status_flags::dynallocated); } /** Compute LCM (Least Common Multiple) of multivariate polynomials in Z[X].