 |
My Project
debian-1:4.1.1-p2+ds-4
|
Go to the documentation of this file.
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
116 static inline number
npAddM(number a, number
b,
const coeffs r)
118 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
119 return (number)(
R >= r->ch ?
R - r->ch :
R);
123 unsigned long R = (
unsigned long)a + (
unsigned long)
b;
124 a=(number)(
R >= r->ch ?
R - r->ch :
R);
126 static inline number
npSubM(number a, number
b,
const coeffs 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 = (long)((
unsigned long)a + (
unsigned long)
b);
137 res += ((long)
res >> 63) & r->ch;
139 res += ((long)
res >> 31) & r->ch;
145 unsigned long res = (long)((
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));
187 #define npEqualM(A,B,r) ((A)==(B))
static number npMultM(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 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)
static void npInpMultM(number &a, number b, const coeffs r)
static BOOLEAN npIsZeroM(number a, const coeffs)
nMapFunc npSetMap(const coeffs src, const coeffs dst)