 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
29 #define NV_MAX_PRIME 32749
30 #define FACTORY_MAX_PRIME 536870909
60 #ifdef HAVE_GENERIC_MULT
64 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
69 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
74 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
75 #ifdef HAVE_GENERIC_ADD
76 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
80 x += (
x >> 63) & r->npPminus1M;
82 x += (
x >> 31) & r->npPminus1M;
85 return (number)(long)r->npExpTable[
x];
89 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
90 #ifdef HAVE_GENERIC_ADD
91 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
95 x += (
x >> 63) & r->npPminus1M;
97 x += (
x >> 31) & r->npPminus1M;
100 a=(number)(
long)r->npExpTable[
x];
105 inline number npAddAsm(number a, number
b,
int m)
108 asm (
"addl %2, %1; cmpl %3, %1; jb 0f; subl %3, %1; 0:"
110 :
"%0" (a),
"g" (
b),
"g" (
m)
114 inline number npSubAsm(number a, number
b,
int m)
117 asm (
"subl %2, %1; jnc 0f; addl %3, %1; 0:"
119 :
"%0" (a),
"g" (
b),
"g" (
m)
124 #ifdef HAVE_GENERIC_ADD
125 static inline number
npAddM(number a, number
b,
const coeffs r)
127 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
128 return (number)(
R >= r->ch ?
R - r->ch :
R);
132 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
133 a=(number)(
R >= r->ch ?
R - r->ch :
R);
135 static inline number
npSubM(number a, number
b,
const coeffs r)
137 return (number)((long)a<(
long)
b ?
138 r->ch-(long)
b+(
long)a : (long)a-(
long)
b);
141 static inline number
npAddM(number a, number
b,
const coeffs r)
143 unsigned long res = (long)((
unsigned long)a + (
unsigned long)
b);
146 res += ((long)
res >> 63) & r->ch;
148 res += ((long)
res >> 31) & r->ch;
154 unsigned long res = (long)((
unsigned long)a + (
unsigned long)
b);
157 res += ((long)
res >> 63) & r->ch;
159 res += ((long)
res >> 31) & r->ch;
163 static inline number
npSubM(number a, number
b,
const coeffs r)
165 long res = ((long)a - (
long)
b);
167 res += (
res >> 63) & r->ch;
169 res += (
res >> 31) & r->ch;
177 return (number)((long)(r->ch)-(long)(a));
195 XGCD(d,
s, t, a,
R->ch);
198 long u,
v, u0, v0, u1, u2, q, r;
219 #ifdef HAVE_GENERIC_ADD
226 s += (
s >> 63) &
R->ch;
228 s += (
s >> 31) &
R->ch;
237 #ifndef HAVE_GENERIC_MULT
238 #ifndef HAVE_INVTABLE
239 number d = (number)(
long)r->npExpTable[r->npPminus1M - r->npLogTable[(long)c]];
241 long inv=(long)r->npInvTable[(
long)c];
244 inv = (long)r->npExpTable[r->npPminus1M - r->npLogTable[(
long)c]];
245 r->npInvTable[(long)c]=inv;
247 number d = (number)inv;
251 long inv=(long)r->npInvTable[(
long)c];
255 r->npInvTable[(long)c]=inv;
260 number d = (number)inv;
275 #define npEqualM(A,B,r) ((A)==(B))
static number npMultM(number a, number b, const coeffs r)
number npMult(number a, number b, const coeffs r)
static number npAddM(number a, number b, const coeffs r)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static number npSubM(number a, number b, const coeffs r)
static number npNegM(number a, const coeffs r)
BOOLEAN npInitChar(coeffs r, void *p)
static BOOLEAN npIsOne(number a, const coeffs)
static long npInvMod(long a, const coeffs R)
static void npInpAddM(number &a, number b, const coeffs r)
'SR_INT' is the type of those integers small enough to fit into 29 bits.
long npInt(number &n, const coeffs r)
const Variable & v
< [in] a sqrfree bivariate poly
static void npInpMultM(number &a, number b, const coeffs r)
const CanonicalForm int s
static BOOLEAN npIsZeroM(number a, const coeffs)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
nMapFunc npSetMap(const coeffs src, const coeffs dst)
static number npInversM(number c, const coeffs r)