29 #define NV_MAX_PRIME 32749
30 #define FACTORY_MAX_PRIME 536870909
51 #ifdef HAVE_GENERIC_MULT
55 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
60 ((((
unsigned long) a)*((
unsigned long)
b)) % ((
unsigned long) r->ch));
65 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
66 #ifdef HAVE_GENERIC_ADD
67 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
71 x += (
x >> 63) & r->npPminus1M;
73 x += (
x >> 31) & r->npPminus1M;
76 return (number)(long)r->npExpTable[
x];
80 long x = (long)r->npLogTable[(
long)a]+ r->npLogTable[(long)
b];
81 #ifdef HAVE_GENERIC_ADD
82 if (
x>=r->npPminus1M)
x-=r->npPminus1M;
86 x += (
x >> 63) & r->npPminus1M;
88 x += (
x >> 31) & r->npPminus1M;
91 a=(number)(
long)r->npExpTable[
x];
96 inline number npAddAsm(number a, number
b,
int m)
99 asm (
"addl %2, %1; cmpl %3, %1; jb 0f; subl %3, %1; 0:"
101 :
"%0" (a),
"g" (
b),
"g" (
m)
105 inline number npSubAsm(number a, number
b,
int m)
108 asm (
"subl %2, %1; jnc 0f; addl %3, %1; 0:"
110 :
"%0" (a),
"g" (
b),
"g" (
m)
115 #ifdef HAVE_GENERIC_ADD
118 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
119 return (number)(
R >= (
unsigned long)r->ch ?
R - (
unsigned long)r->ch :
R);
123 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
124 a=(number)(
R >= (
unsigned long)r->ch ?
R - (
unsigned long)r->ch :
R);
128 return (number)((long)a<(
long)
b ?
129 r->ch-(long)
b+(
long)a : (long)a-(
long)
b);
132 static inline number
npAddM(number a, number
b,
const coeffs r)
134 unsigned long res = ((
unsigned long)a + (
unsigned long)
b);
137 res += ((long)
res >> 63) & r->ch;
139 res += ((long)
res >> 31) & r->ch;
145 unsigned long res = ((
unsigned long)a + (
unsigned long)
b);
148 res += ((long)
res >> 63) & r->ch;
150 res += ((long)
res >> 31) & r->ch;
154 static inline number
npSubM(number a, number
b,
const coeffs r)
156 long res = ((long)a - (
long)
b);
158 res += (
res >> 63) & r->ch;
160 res += (
res >> 31) & r->ch;
168 return (number)((long)(r->ch)-(long)(a));
180 long u,
v, u0, u1, u2, q, r;
200 #ifdef HAVE_GENERIC_ADD
207 s += (
s >> 63) &
R->ch;
209 s += (
s >> 31) &
R->ch;
218 #ifndef HAVE_GENERIC_MULT
219 #ifndef HAVE_INVTABLE
220 number d = (number)(
long)r->npExpTable[r->npPminus1M - r->npLogTable[(long)c]];
222 long inv=(long)r->npInvTable[(
long)c];
225 inv = (long)r->npExpTable[r->npPminus1M - r->npLogTable[(
long)c]];
226 r->npInvTable[(long)c]=inv;
228 number d = (number)inv;
232 long inv=(long)r->npInvTable[(
long)c];
236 r->npInvTable[(long)c]=inv;
241 number d = (number)inv;
251 #define npEqualM(A,B,r) ((A)==(B))
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
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)
static long npInvMod(long a, const coeffs R)
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.