THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN FUTURE GNU MP RELEASES.
Copyright 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
or
* the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
or both in parallel, as here.
The GNU MP Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include"gmp-impl.h"
/* Calculate a remainder from {p,n} divided by 2^(GMP_NUMB_BITS*3/4)-1. The remainder is not fully reduced, it's any limb value congruent to {p,n} modulo that divisor.
This implementation is only correct when GMP_NUMB_BITS is a multiple of 4.
FIXME: If GMP_NAIL_BITS is some silly big value during development then it's possible the carry accumulators c0,c1,c2 could overflow.
General notes:
The basic idea is to use a set of N accumulators (N=3 in this case) to effectively get a remainder mod 2^(GMP_NUMB_BITS*N)-1 followed at the end by a reduction to GMP_NUMB_BITS*N/M bits (M=4 in this case) for a remainder mod 2^(GMP_NUMB_BITS*N/M)-1. N and M are chosen to give a good set of small prime factors in 2^(GMP_NUMB_BITS*N/M)-1.
N=3 M=4 suits GMP_NUMB_BITS==32 and GMP_NUMB_BITS==64 quite well, giving a few more primes than a single accumulator N=1 does, and for no extra cost (assuming the processor has a decent number of registers).
For strange nailified values of GMP_NUMB_BITS the idea would be to look for what N and M give good primes. With GMP_NUMB_BITS not a power of 2 the choices for M may be opened up a bit. But such things are probably
best done in separate code, not grafted on here. */
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.