#include "config.h"
#include <string.h>
#include "cf_assert.h"
#include "cf_defs.h"
#include "ffops.h"
Go to the source code of this file.
◆ ff_biginv()
int ff_biginv |
( |
const int |
a | ) |
|
Definition at line 72 of file ffops.cc.
73{
74 if (a < 2)
75 return a;
76 int p, q, r1, r2, y1, y2;
78 q = r1 / a;
79 y1 = -q;
80 r1 -= a * q;
81 if (r1 == 1)
83 r2 = a;
84 y2 = 1;
85 for (;;)
86 {
87 q = r2 / r1;
88 y2 -= y1 * q;
89 r2 -= r1 * q;
90 if (r2 == 1)
91 {
92 if (y2 > 0)
93 return y2;
94 else
96 }
97 q = r1 / r2;
98 y1 -= y2 * q;
99 r1 -= r2 * q;
100 if (r1 == 1)
101 {
102 if (y1 > 0)
103 return y1;
104 else
106 }
107 }
108}
◆ ff_newinv()
int ff_newinv |
( |
const int |
a | ) |
|
Definition at line 30 of file ffops.cc.
31{
32 if (a < 2)
34 int p, q, r1, r2, y1, y2;
36 q = r1 / a;
37 y1 = -q;
38 r1 -= a * q;
39 if (r1 == 1)
40 {
44 }
45 r2 = a;
46 y2 = 1;
47 for (;;)
48 {
49 q = r2 / r1;
50 y2 -= y1 * q;
51 r2 -= r1 * q;
52 if (r2 == 1)
53 {
54 if (y2 < 0)
58 }
59 q = r1 / r2;
60 y1 -= y2 * q;
61 r1 -= r2 * q;
62 if (r1 == 1)
63 {
64 if (y1 < 0)
68 }
69 }
70}
◆ ff_setprime()
void ff_setprime |
( |
const int |
p | ) |
|
◆ ff_big
◆ ff_halfprime
◆ ff_invtab
VAR short* ff_invtab = new short [32767] |
◆ ff_prime