21 #define NV_MAX_PRIME 32749 46 ((((
unsigned long)
a)*((
unsigned long)
b)) % ((
unsigned long)
r->ch));
51 long x = (long)
r->npLogTable[(
long)
a]+
r->npLogTable[(long)
b];
52 return (number)(long)
r->npExpTable[x<r->npPminus1M ?
x :
x-
r->npPminus1M];
57 inline number npAddAsm(number
a, number
b,
int m)
60 asm (
"addl %2, %1; cmpl %3, %1; jb 0f; subl %3, %1; 0:" 62 :
"%0" (
a),
"g" (
b),
"g" (
m)
66 inline number npSubAsm(number
a, number
b,
int m)
69 asm (
"subl %2, %1; jnc 0f; addl %3, %1; 0:" 71 :
"%0" (
a),
"g" (
b),
"g" (
m)
76 #ifdef HAVE_GENERIC_ADD 79 unsigned long R = (
unsigned long)
a + (
unsigned long)
b;
80 return (number)(
R >=
r->ch ?
R -
r->ch :
R);
84 return (number)((long)
a<(
long)
b ?
85 r->ch-(long)
b+(
long)
a : (long)
a-(
long)
b);
90 unsigned long res = (long)((
unsigned long)
a + (
unsigned long)
b);
93 res += ((long)
res >> 63) &
r->ch;
95 res += ((long)
res >> 31) &
r->ch;
101 long res = ((long)
a - (
long)
b);
113 return (number)((long)(
r->ch)-(long)(
a));
132 #define npEqualM(A,B,r) ((A)==(B))
static number npMultM(number a, number b, const coeffs r)
'SR_INT' is the type of those integers small enough to fit into 29 bits.
BOOLEAN npInitChar(coeffs r, void *p)
static number npNegM(number a, 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.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static number npAddM(number a, number b, const coeffs r)
static BOOLEAN npIsZeroM(number a, const coeffs)
long npInt(number &n, const coeffs r)
nMapFunc npSetMap(const coeffs src, const coeffs dst)