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
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);
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))
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
'SR_INT' is the type of those integers small enough to fit into 29 bits.
static BOOLEAN npIsOne(number a, const coeffs)
static number npAddM(number a, number b, const coeffs r)
static number npMultM(number a, number b, const coeffs r)
BOOLEAN npInitChar(coeffs r, void *p)
static number npNegM(number a, const coeffs r)
static void npInpMultM(number &a, number b, const coeffs r)
nMapFunc npSetMap(const coeffs src, const coeffs dst)
number npMult(number a, number b, const coeffs r)
static long npInvMod(long a, const coeffs R)
static BOOLEAN npIsZeroM(number a, const coeffs)
static number npInversM(number c, const coeffs r)
long npInt(number &n, const coeffs r)
static void npInpAddM(number &a, number b, const coeffs r)
static number npSubM(number a, number b, const coeffs r)
The main handler for Singular numbers which are suitable for Singular polynomials.