YoushouldhavereceivedcopiesoftheGNUGeneralPublicLicenseandthe GNULesserGeneralPublicLicensealongwiththeGNUMPLibrary.Ifnot,
see https://www.gnu.org/licenses/. */
#include"gmp-impl.h"
/* As usual the aim is to produce PREC(r) limbs, with the high non-zero. The basicmpn_div_qproducesaquotientofnsize-dsize+1limbs,witheitherthe highorsecondhighestlimbnon-zero.Wearrangefornsize-dsize+1toequal prec+1,hencegivingeitherprecorprec+1resultlimbsatPTR(r).
Thehighquotientlimbisnon-zerowhenhigh{np,dsize}>{dp,dsize}.We couldmakethatcomparisonanduseqsize==precinsteadofqsize==prec+1,
to save one limb in the division. */
prospective_qsize = nsize - dsize + 1; /* q from using given n,d sizes */
exp = prospective_qsize; /* ie. number of integer limbs */
qsize = prec + 1; /* desired q */
zeros = qsize - prospective_qsize; /* n zeros to get desired qsize */
tsize = nsize + zeros; /* size of intermediate numerator */
tp = TMP_ALLOC_LIMBS (tsize + 1); /* +1 for mpn_div_q's scratch */
if (zeros > 0)
{ /* pad n with zeros into temporary space */
MPN_ZERO (tp, zeros);
MPN_COPY (tp+zeros, np, nsize);
np = tp; /* mpn_div_q allows this overlap */
} else
{ /* shorten n to get desired qsize */
np -= zeros;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.