From: Richard Kreckel Date: Wed, 12 Oct 2022 22:12:07 +0000 (+0200) Subject: Optimize some use of CLN's expt_pos() function in factor(). X-Git-Tag: release_1-8-5~11 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=cdce7eb2282dbb095e9ae079da371c78b7c5150e;p=ginac.git Optimize some use of CLN's expt_pos() function in factor(). (Not that it's slow or mattered much, but why waste cycles?) --- diff --git a/ginac/factor.cpp b/ginac/factor.cpp index d30cf956..fde15b32 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -1206,7 +1206,7 @@ static inline cl_I calc_bound(const ex& a, const ex& x, int maxdeg) coeff = coeff + square(aa); } cl_I coeffnorm = ceiling1(the(cln::sqrt(coeff))); - cl_I B = coeffnorm * expt_pos(cl_I(2), cl_I(maxdeg)); + cl_I B = coeffnorm * ash(cl_I(1), maxdeg); // coeffnorm * 2^maxdeg return ( B > maxcoeff ) ? B : maxcoeff; } @@ -1223,7 +1223,7 @@ static inline cl_I calc_bound(const upoly& a, int maxdeg) coeff = coeff + square(aa); } cl_I coeffnorm = ceiling1(the(cln::sqrt(coeff))); - cl_I B = coeffnorm * expt_pos(cl_I(2), cl_I(maxdeg)); + cl_I B = coeffnorm * ash(cl_I(1), maxdeg); // coeffnorm * 2^maxdeg return ( B > maxcoeff ) ? B : maxcoeff; } @@ -2409,7 +2409,7 @@ static ex factor_multivariate(const ex& poly, const exset& syms) } // set up modular factors (mod p^l) - cl_modint_ring R = find_modint_ring(expt_pos(cl_I(prime),l)); + cl_modint_ring R = find_modint_ring(pl); upvec modfactors(ufaclst.nops()-1); for ( size_t i=1; i