 |
My Project
debian-1:4.1.2-p1+ds-2
|
Go to the documentation of this file.
29 #define NV_MAX_PRIME 32749
30 #define FACTORY_MAX_PRIME 536870909
34 extern void XGCD(
long& d,
long&
s,
long& t,
long a,
long b);
56 #ifdef HAVE_GENERIC_MULT
60 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
65 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
70 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
71 #ifdef HAVE_GENERIC_ADD
72 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
76 x += (
x >> 63) & r->npPminus1M;
78 x += (
x >> 31) & r->npPminus1M;
81 return (number)(long)r->npExpTable[
x];
85 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
86 #ifdef HAVE_GENERIC_ADD
87 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
91 x += (
x >> 63) & r->npPminus1M;
93 x += (
x >> 31) & r->npPminus1M;
96 a=(number)(
long)r->npExpTable[
x];
101 inline number npAddAsm(number a, number
b,
int m)
104 asm (
"addl %2, %1; cmpl %3, %1; jb 0f; subl %3, %1; 0:"
106 :
"%0" (a),
"g" (
b),
"g" (
m)
110 inline number npSubAsm(number a, number
b,
int m)
113 asm (
"subl %2, %1; jnc 0f; addl %3, %1; 0:"
115 :
"%0" (a),
"g" (
b),
"g" (
m)
120 #ifdef HAVE_GENERIC_ADD
121 static inline number
npAddM(number a, number
b,
const coeffs r)
123 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
124 return (number)(
R >= r->ch ?
R - r->ch :
R);
128 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
129 a=(number)(
R >= r->ch ?
R - r->ch :
R);
131 static inline number
npSubM(number a, number
b,
const coeffs r)
133 return (number)((long)a<(
long)
b ?
134 r->ch-(long)
b+(
long)a : (long)a-(
long)
b);
137 static inline number
npAddM(number a, number
b,
const coeffs r)
139 unsigned long res = (long)((
unsigned long)a + (
unsigned long)
b);
142 res += ((long)
res >> 63) & r->ch;
144 res += ((long)
res >> 31) & r->ch;
150 unsigned long res = (long)((
unsigned long)a + (
unsigned long)
b);
153 res += ((long)
res >> 63) & r->ch;
155 res += ((long)
res >> 31) & r->ch;
159 static inline number
npSubM(number a, number
b,
const coeffs r)
161 long res = ((long)a - (
long)
b);
163 res += (
res >> 63) & r->ch;
165 res += (
res >> 31) & r->ch;
173 return (number)((long)(r->ch)-(long)(a));
191 XGCD(d,
s, t, a,
R->ch);
194 long u,
v, u0, v0, u1, u2, q, r;
215 #ifdef HAVE_GENERIC_ADD
222 s += (
s >> 63) &
R->ch;
224 s += (
s >> 31) &
R->ch;
233 #ifndef HAVE_GENERIC_MULT
234 #ifndef HAVE_INVTABLE
235 number d = (number)(
long)r->npExpTable[r->npPminus1M - r->npLogTable[(long)c]];
237 long inv=(long)r->npInvTable[(
long)c];
240 inv = (long)r->npExpTable[r->npPminus1M - r->npLogTable[(
long)c]];
241 r->npInvTable[(long)c]=inv;
243 number d = (number)inv;
247 long inv=(long)r->npInvTable[(
long)c];
251 r->npInvTable[(long)c]=inv;
256 number d = (number)inv;
271 #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)