summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-04-23 01:05:50 +0200
committerKevin Ryde <user42@zip.com.au>2002-04-23 01:05:50 +0200
commit2106eb177700e1eeef58b96071d1512266e90f32 (patch)
tree0e9f29f7b943cffa06bc00470bf6f45ebf7002d2
parent5a1a609600ccbb08124ec486e92691609826302b (diff)
downloadgmp-2106eb177700e1eeef58b96071d1512266e90f32.tar.gz
* mpz/kronzu.c, mpz/kronuz.c, mpz/kronzs.c, mpz/kronsz.c: Nailify.
-rw-r--r--mpz/kronuz.c16
-rw-r--r--mpz/kronzu.c18
2 files changed, 25 insertions, 9 deletions
diff --git a/mpz/kronuz.c b/mpz/kronuz.c
index 50920a4fe..dbe927ad9 100644
--- a/mpz/kronuz.c
+++ b/mpz/kronuz.c
@@ -1,6 +1,5 @@
-/* mpz_ui_kronecker -- ulong+mpz Kronecker/Jacobi symbol. */
+/* mpz_ui_kronecker -- ulong+mpz Kronecker/Jacobi symbol.
-/*
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -18,8 +17,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.
-*/
+MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@@ -49,6 +47,16 @@ mpz_ui_kronecker (unsigned long a, mpz_srcptr b)
if (b_abs_size == 0)
return JACOBI_U0 (a); /* (a/0) */
+ if (a > GMP_NUMB_MAX)
+ {
+ mp_limb_t alimbs[2];
+ mpz_t az;
+ ALLOC(az) = numberof (alimbs);
+ PTR(az) = alimbs;
+ mpz_set_ui (az, a);
+ return mpz_kronecker (az, b);
+ }
+
if (! (b_low & 1))
{
/* (0/b)=0 for b!=+/-1; (even/even)=0 */
diff --git a/mpz/kronzu.c b/mpz/kronzu.c
index 0d76ad74d..7f33eece2 100644
--- a/mpz/kronzu.c
+++ b/mpz/kronzu.c
@@ -1,7 +1,6 @@
-/* mpz_kronecker_ui -- mpz+ulong Kronecker/Jacobi symbol. */
+/* mpz_kronecker_ui -- mpz+ulong Kronecker/Jacobi symbol.
-/*
-Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -18,8 +17,7 @@ License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.
-*/
+MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@@ -46,6 +44,16 @@ mpz_kronecker_ui (mpz_srcptr a, unsigned long b)
if (a_size == 0)
return JACOBI_0U (b);
+ if (b > GMP_NUMB_MAX)
+ {
+ mp_limb_t blimbs[2];
+ mpz_t bz;
+ ALLOC(bz) = numberof (blimbs);
+ PTR(bz) = blimbs;
+ mpz_set_ui (bz, b);
+ return mpz_kronecker (a, bz);
+ }
+
if ((b & 1) != 0)
{
result_bit1 = JACOBI_ASGN_SU_BIT1 (a_size, b);