projects
/
u
/
mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0c9d150
)
Better reduction.
author
mdw
<mdw>
Wed, 1 Dec 2004 01:30:06 +0000
(
01:30
+0000)
committer
mdw
<mdw>
Wed, 1 Dec 2004 01:30:06 +0000
(
01:30
+0000)
f-niceprime.c
patch
|
blob
|
blame
|
history
f-prime.c
patch
|
blob
|
blame
|
history
diff --git
a/f-niceprime.c
b/f-niceprime.c
index
ce96977
..
4c9deea
100644
(file)
--- a/
f-niceprime.c
+++ b/
f-niceprime.c
@@
-99,20
+99,20
@@
static mp *fsqrt(field *ff, mp *d, mp *x) {
static mp *fdbl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; d = mp_lsl(d, x, 1);
static mp *fdbl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; d = mp_lsl(d, x, 1);
- if (MP_CMP(d, >, f->r.p)) d = mp_sub(d, d, f->r.p);
+ if (MP_CMP(d, >
=
, f->r.p)) d = mp_sub(d, d, f->r.p);
return (d);
}
static mp *ftpl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; MP_DEST(d, MP_LEN(x) + 1, x->f);
return (d);
}
static mp *ftpl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; MP_DEST(d, MP_LEN(x) + 1, x->f);
- MPX_UMULN(d->v, d->vl, x->v, x->vl, 3);
- while (MP_CMP(d, >, f->r.p)) d = mp_sub(d, d, f->r.p);
+ MPX_UMULN(d->v, d->vl, x->v, x->vl, 3);
d->f &= ~MP_UNDEF;
+ while (MP_CMP(d, >
=
, f->r.p)) d = mp_sub(d, d, f->r.p);
return (d);
}
static mp *fqdl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; d = mp_lsl(d, x, 2);
return (d);
}
static mp *fqdl(field *ff, mp *d, mp *x) {
fctx_niceprime *f = (fctx_niceprime *)ff; d = mp_lsl(d, x, 2);
- while (MP_CMP(d, >, f->r.p)) d = mp_sub(d, d, f->r.p);
+ while (MP_CMP(d, >
=
, f->r.p)) d = mp_sub(d, d, f->r.p);
return (d);
}
return (d);
}
@@
-157,6
+157,7
@@
field *field_niceprime(mp *p)
return (0);
}
f->f.m = f->r.p;
return (0);
}
f->f.m = f->r.p;
+ f->f.q = f->r.p;
return (&f->f);
}
return (&f->f);
}
diff --git
a/f-prime.c
b/f-prime.c
index
f2fd7eb
..
422c386
100644
(file)
--- a/
f-prime.c
+++ b/
f-prime.c
@@
-111,20
+111,20
@@
static mp *fsqrt(field *ff, mp *d, mp *x) {
static mp *fdbl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; d = mp_lsl(d, x, 1);
static mp *fdbl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; d = mp_lsl(d, x, 1);
- if (MP_CMP(d, >, f->mm.m)) d = mp_sub(d, d, f->mm.m);
+ if (MP_CMP(d, >
=
, f->mm.m)) d = mp_sub(d, d, f->mm.m);
return (d);
}
static mp *ftpl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; MP_DEST(d, MP_LEN(x) + 1, x->f);
return (d);
}
static mp *ftpl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; MP_DEST(d, MP_LEN(x) + 1, x->f);
- MPX_UMULN(d->v, d->vl, x->v, x->vl, 3);
- while (MP_CMP(d, >, f->mm.m)) d = mp_sub(d, d, f->mm.m);
+ MPX_UMULN(d->v, d->vl, x->v, x->vl, 3);
d->f &= ~MP_UNDEF;
+ while (MP_CMP(d, >
=
, f->mm.m)) d = mp_sub(d, d, f->mm.m);
return (d);
}
static mp *fqdl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; d = mp_lsl(d, x, 2);
return (d);
}
static mp *fqdl(field *ff, mp *d, mp *x) {
fctx_prime *f = (fctx_prime *)ff; d = mp_lsl(d, x, 2);
- while (MP_CMP(d, >, f->mm.m)) d = mp_sub(d, d, f->mm.m);
+ while (MP_CMP(d, >
=
, f->mm.m)) d = mp_sub(d, d, f->mm.m);
return (d);
}
return (d);
}