summaryrefslogtreecommitdiff
path: root/src/mpfr-mini-gmp.h
blob: c3413cef3ce9b02be2078a6e2c0039b566e84d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* mpfr-mini-gmp.h -- Interface header for mini-gmp.

Copyright 2014-2020 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.

This file is part of the GNU MPFR Library.

The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

The GNU MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
License for more details.

You should have received a copy of the GNU Lesser General Public License
along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */

#include <stdlib.h> /* for size_t */
#include "gmp.h"

#ifndef gmp_version
extern char gmp_version[];
#endif

#ifndef GMP_NUMB_BITS
/* see https://gmplib.org/list-archives/gmp-bugs/2015-October/003755.html */
#include <limits.h>
#define GMP_NUMB_BITS (CHAR_BIT * sizeof(mp_limb_t))
#endif

#ifndef mp_limb_signed_t
typedef long mp_limb_signed_t;
#endif

#ifndef __gmp_allocate_func
#define __gmp_allocate_func gmp_default_alloc
#define __gmp_reallocate_func gmp_default_realloc
#define __gmp_free_func gmp_default_free
#endif

#ifndef gmp_randstate_t
typedef long int __gmp_randstate_struct;
typedef __gmp_randstate_struct gmp_randstate_t[1];
#endif

#ifndef gmp_randinit_default
#define WANT_gmp_randinit_default
void gmp_randinit_default (gmp_randstate_t);
#endif

#ifndef gmp_randseed_ui
#define WANT_gmp_randseed_ui
void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
#endif

#ifndef gmp_randclear
#define WANT_gmp_randclear
void gmp_randclear (gmp_randstate_t);
#endif

#ifndef gmp_randinit_set
#define WANT_gmp_randinit_set
void gmp_randinit_set (gmp_randstate_t, gmp_randstate_t);
#endif

#ifndef mpn_scan1
#define WANT_mpn_scan1
mp_bitcnt_t mpn_scan1 (const mp_limb_t *, mp_bitcnt_t);
#endif

#ifndef mpz_perfect_square_p
#define WANT_mpz_perfect_square_p
int mpz_perfect_square_p (const mpz_t);
#endif

#ifndef mpz_addmul_ui
#define WANT_mpz_addmul_ui
void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long);
#endif

#ifndef mpn_divrem_1
#define WANT_mpn_divrem_1
mp_limb_t mpn_divrem_1 (mp_limb_t*, mp_size_t, mp_limb_t*, mp_size_t,
                        mp_limb_t);
#endif

#ifndef mpz_urandomb
#define WANT_mpz_urandomb
void mpz_urandomb (mpz_t, gmp_randstate_t, mp_bitcnt_t);
#endif

#ifndef mpn_zero
#define WANT_mpn_zero
void mpn_zero (mp_limb_t *, mp_size_t);
#endif

#ifndef mpn_popcount
#define WANT_mpn_popcount
mp_bitcnt_t mpn_popcount (const mp_limb_t *, mp_size_t);
#endif

#ifndef gmp_urandomm_ui
#define WANT_gmp_urandomm_ui
unsigned long gmp_urandomm_ui (gmp_randstate_t state, unsigned long n);
#endif

#ifndef gmp_urandomb_ui
#define WANT_gmp_urandomb_ui
unsigned long gmp_urandomb_ui (gmp_randstate_t state, unsigned long n);
#endif

#ifndef mpn_divrem
#define WANT_mpn_divrem
mp_limb_t mpn_divrem (mp_limb_t *, mp_size_t, mp_limb_t *,
                      mp_size_t, const mp_limb_t *, mp_size_t);
#endif

#ifndef mpz_submul
#define WANT_mpz_submul
void mpz_submul (mpz_t, const mpz_t, const mpz_t);
#endif

#ifndef mpz_addmul
#define WANT_mpz_addmul
void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
#endif

#ifndef mpn_tdiv_qr
#define WANT_mpn_tdiv_qr
void mpn_tdiv_qr (mp_limb_t *, mp_limb_t *, mp_size_t,
                  const mp_limb_t *, mp_size_t, const mp_limb_t *, mp_size_t);
#endif

#ifndef mpz_rrandomb
#define mpz_rrandomb mpz_urandomb
#endif