21 #define NV_MAX_PRIME 32003 43 static inline number
npMultM(number
a, number
b,
const coeffs
r)
46 ((((
unsigned long) a)*((
unsigned long) b)) % ((
unsigned long) r->ch));
49 static inline number
npMultM(number a, number b,
const coeffs r)
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 77 static inline number
npAddM(number a, number b,
const coeffs r)
79 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
80 return (number)(R >= r->ch ? R - r->ch :
R);
82 static inline number
npSubM(number a, number b,
const coeffs r)
84 return (number)((long)a<(
long)b ?
85 r->ch-(long)b+(
long)a : (long)a-(
long)
b);
88 static inline number
npAddM(number a, number b,
const coeffs r)
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;
99 static inline number
npSubM(number a, number b,
const coeffs r)
101 long res = ((long)a - (
long)
b);
103 res += (res >> 63) & r->ch;
105 res += (res >> 31) & r->ch;
111 static inline number
npNegM(number a,
const coeffs r)
113 return (number)((long)(r->ch)-(long)(a));
127 long npInt (number &
n,
const coeffs r);
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)