summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2000-04-29 00:19:21 +0200
committerKevin Ryde <user42@zip.com.au>2000-04-29 00:19:21 +0200
commit2f9727d588f7741f349791ec5dacef726c538719 (patch)
tree0e93d349e9e272c3c5344b42ae832d573b75e8f9 /mpz
parentb856b597ab91c14af5e63dbfd43f3a171516ac8f (diff)
downloadgmp-2f9727d588f7741f349791ec5dacef726c538719.tar.gz
Provide dual ANSI/K&R function definitions.
Diffstat (limited to 'mpz')
-rw-r--r--mpz/pprime_p.c25
-rw-r--r--mpz/rrandomb.c8
-rw-r--r--mpz/set_str.c8
-rw-r--r--mpz/ui_pow_ui.c9
4 files changed, 41 insertions, 9 deletions
diff --git a/mpz/pprime_p.c b/mpz/pprime_p.c
index d488ebd3d..a9460adbd 100644
--- a/mpz/pprime_p.c
+++ b/mpz/pprime_p.c
@@ -30,13 +30,17 @@ MA 02111-1307, USA. */
#include "gmp-impl.h"
#include "longlong.h"
-static int isprime ();
-static int mpz_millerrabin ();
+static int isprime _PROTO ((unsigned long int t));
+static int mpz_millerrabin _PROTO ((mpz_srcptr n, int reps));
int
+#if __STDC__
+mpz_probab_prime_p (mpz_srcptr n, int reps)
+#else
mpz_probab_prime_p (n, reps)
mpz_srcptr n;
int reps;
+#endif
{
mp_limb_t r;
@@ -123,8 +127,12 @@ mpz_probab_prime_p (n, reps)
}
static int
+#if __STDC__
+isprime (unsigned long int t)
+#else
isprime (t)
unsigned long int t;
+#endif
{
unsigned long int q, r, d;
@@ -141,12 +149,18 @@ isprime (t)
return 0;
}
-static int millerrabin ();
+static int millerrabin _PROTO ((mpz_srcptr n, mpz_srcptr nm1,
+ mpz_ptr x, mpz_ptr y,
+ mpz_srcptr q, unsigned long int k));
static int
+#if __STDC__
+mpz_millerrabin (mpz_srcptr n, int reps)
+#else
mpz_millerrabin (n, reps)
mpz_srcptr n;
int reps;
+#endif
{
int r;
mpz_t nm1, x, y, q;
@@ -196,6 +210,10 @@ mpz_millerrabin (n, reps)
}
static int
+#if __STDC__
+millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y,
+ mpz_srcptr q, unsigned long int k)
+#else
millerrabin (n, nm1, x, y, q, k)
mpz_srcptr n;
mpz_srcptr nm1;
@@ -203,6 +221,7 @@ millerrabin (n, nm1, x, y, q, k)
mpz_ptr y;
mpz_srcptr q;
unsigned long int k;
+#endif
{
unsigned long int i;
diff --git a/mpz/rrandomb.c b/mpz/rrandomb.c
index fd951d753..655941b5f 100644
--- a/mpz/rrandomb.c
+++ b/mpz/rrandomb.c
@@ -1,4 +1,4 @@
-/* mpz_brandom -- Generate a positive random mpz_t of specified bit size, with
+/* mpz_rrandomb -- Generate a positive random mpz_t of specified bit size, with
long runs of consecutive ones and zeros in the binary representation.
Meant for testing of other MP routines.
@@ -24,7 +24,7 @@ MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-static void gmp_rrandomb ();
+static void gmp_rrandomb _PROTO ((mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits));
void
#if __STDC__
@@ -56,10 +56,14 @@ mpz_rrandomb (x, rstate, nbits)
#define BITS_PER_CHUNK 4
static void
+#if __STDC__
+gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits)
+#else
gmp_rrandomb (rp, rstate, nbits)
mp_ptr rp;
gmp_randstate_t rstate;
unsigned long int nbits;
+#endif
{
int nb;
int bit_pos;
diff --git a/mpz/set_str.c b/mpz/set_str.c
index 07f23e4e3..daab89267 100644
--- a/mpz/set_str.c
+++ b/mpz/set_str.c
@@ -4,8 +4,8 @@
the base in the C standard way, i.e. 0xhh...h means base 16,
0oo...o means base 8, otherwise assume base 10.
-Copyright (C) 1991, 1993, 1994, 1996, 1997, 1998 Free Software Foundation,
-Inc.
+Copyright (C) 1991, 1993, 1994, 1996, 1997, 1998, 2000 Free Software
+Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,9 +31,13 @@ MA 02111-1307, USA. */
#include "longlong.h"
static int
+#if __STDC__
+digit_value_in_base (int c, int base)
+#else
digit_value_in_base (c, base)
int c;
int base;
+#endif
{
int digit;
diff --git a/mpz/ui_pow_ui.c b/mpz/ui_pow_ui.c
index 4a9020d80..781fdb520 100644
--- a/mpz/ui_pow_ui.c
+++ b/mpz/ui_pow_ui.c
@@ -1,6 +1,7 @@
/* mpz_ui_pow_ui(res, base, exp) -- Set RES to BASE**EXP.
-Copyright (C) 1991, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
+Copyright (C) 1991, 1993, 1994, 1996, 1997, 2000 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -26,7 +27,7 @@ MA 02111-1307, USA. */
#define swapptr(xp,yp) \
do { mp_ptr _swapptr_tmp = (xp); (xp) = (yp); (yp) = _swapptr_tmp; } while (0)
-static void mpz_pow2 ();
+static void mpz_pow2 _PROTO ((mpz_ptr r, mp_limb_t blimb, unsigned long int e, mp_limb_t rl));
void
#if __STDC__
@@ -75,11 +76,15 @@ mpz_ui_pow_ui (r, b, e)
/* Multi-precision part of expontialization code. */
static void
+#if __STDC__
+mpz_pow2 (mpz_ptr r, mp_limb_t blimb, unsigned long int e, mp_limb_t rl)
+#else
mpz_pow2 (r, blimb, e, rl)
mpz_ptr r;
mp_limb_t blimb;
unsigned long int e;
mp_limb_t rl;
+#endif
{
mp_ptr rp, tp;
mp_size_t ralloc, rsize;