summaryrefslogtreecommitdiff
path: root/mpz/kronsz.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-04-23 01:12:09 +0200
committerKevin Ryde <user42@zip.com.au>2002-04-23 01:12:09 +0200
commit852ff7cba15a2bb30b90fd515bbd39244870dd1a (patch)
tree28cf63b981dce12e7d42e2de3119426fc967b09e /mpz/kronsz.c
parent2106eb177700e1eeef58b96071d1512266e90f32 (diff)
downloadgmp-852ff7cba15a2bb30b90fd515bbd39244870dd1a.tar.gz
* mpz/kronzu.c, mpz/kronuz.c, mpz/kronzs.c, mpz/kronsz.c: Nailify.
Diffstat (limited to 'mpz/kronsz.c')
-rw-r--r--mpz/kronsz.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/mpz/kronsz.c b/mpz/kronsz.c
index 990b1ec20..2d31f0803 100644
--- a/mpz/kronsz.c
+++ b/mpz/kronsz.c
@@ -1,7 +1,6 @@
-/* mpz_si_kronecker -- long+mpz Kronecker/Jacobi symbol. */
+/* mpz_si_kronecker -- long+mpz 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"
@@ -45,6 +43,18 @@ mpz_si_kronecker (long a, mpz_srcptr b)
unsigned twos;
int result_bit1;
+#if GMP_NUMB_BITS < BITS_PER_ULONG
+ if (a > GMP_NUMB_MAX || a < -GMP_NUMB_MAX)
+ {
+ mp_limb_t alimbs[2];
+ mpz_t az;
+ ALLOC(az) = numberof (alimbs);
+ PTR(az) = alimbs;
+ mpz_set_si (az, a);
+ return mpz_kronecker (az, b);
+ }
+#endif
+
if (b_abs_size == 0)
return JACOBI_S0 (a); /* (a/0) */