~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progs/perftest.c: Use from Glibc syscall numbers.
[catacomb]
/
math
/
mp-jacobi.c
diff --git
a/math/mp-jacobi.c
b/math/mp-jacobi.c
index
b1b0216
..
2992076
100644
(file)
--- a/
math/mp-jacobi.c
+++ b/
math/mp-jacobi.c
@@
-59,7
+59,7
@@
* congruent to 1 or 7 (mod 8), or %$-1$% otherwise.
*
* If %$n$% is positive and odd, then this is the Jacobi
* congruent to 1 or 7 (mod 8), or %$-1$% otherwise.
*
* If %$n$% is positive and odd, then this is the Jacobi
- * symbol. (The Kronecker symbol is a consist
a
nt domain
+ * symbol. (The Kronecker symbol is a consist
e
nt domain
* extension; the Jacobi symbol was implemented first, and the
* name stuck.)
*/
* extension; the Jacobi symbol was implemented first, and the
* name stuck.)
*/
@@
-130,7
+130,7
@@
int mp_jacobi(mp *a, mp *n)
goto done;
}
goto done;
}
- /* ---
Main case with powers of two
--- */
+ /* ---
Strip out powers of two from %$a$%
--- */
a = mp_odd(a, a, &e);
nn = n->v[0] & 7;
a = mp_odd(a, a, &e);
nn = n->v[0] & 7;
@@
-138,11
+138,11
@@
int mp_jacobi(mp *a, mp *n)
s = -s;
if (MP_LEN(a) == 1 && a->v[0] == 1)
goto done;
s = -s;
if (MP_LEN(a) == 1 && a->v[0] == 1)
goto done;
- if ((nn & 3) == 3 && (a->v[0] & 3) == 3)
- s = -s;
- /* --- Reduce and swap --- */
+ /* --- Reduce and swap
, applying quadratic residuosity
--- */
+ if ((nn & 3) == 3 && (a->v[0] & 3) == 3)
+ s = -s;
mp_div(0, &n, n, a);
{ mp *t = n; n = a; a = t; }
}
mp_div(0, &n, n, a);
{ mp *t = n; n = a; a = t; }
}