projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
factorial: Fix usage message to fit in with conventions.
[u/mdw/catacomb]
/
gf-arith.c
diff --git
a/gf-arith.c
b/gf-arith.c
index
f380a35
..
eabbff8
100644
(file)
--- a/
gf-arith.c
+++ b/
gf-arith.c
@@
-179,11
+179,17
@@
void gf_div(mp **qq, mp **rr, mp *a, mp *b)
int gf_irreduciblep(mp *f)
{
int gf_irreduciblep(mp *f)
{
- unsigned long m
= mp_bits(f) - 1
;
+ unsigned long m;
mp *u = MP_TWO;
mp *v = MP_NEW;
mp *u = MP_TWO;
mp *v = MP_NEW;
- m /= 2;
+ if (MP_ZEROP(f))
+ return (0);
+ else if (MP_LEN(f) == 1) {
+ if (f->v[0] < 2) return (0);
+ if (f->v[0] < 4) return (1);
+ }
+ m = (mp_bits(f) - 1)/2;
while (m) {
u = gf_sqr(u, u);
gf_div(0, &u, u, f);
while (m) {
u = gf_sqr(u, u);
gf_div(0, &u, u, f);