1 /* gmp.h -- Definitions for GNU multiple precision functions.
3 Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
5 This file is part of the GNU MP Library.
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Library General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 The GNU MP Library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
28 #if defined (__STDC__)
29 #define __gmp_const const
34 #if defined (__GNUC__)
35 #define __gmp_inline inline
41 typedef unsigned int mp_limb
;
42 typedef int mp_limb_signed
;
44 #ifdef _LONG_LONG_LIMB
45 typedef unsigned long long int mp_limb
;
46 typedef long long int mp_limb_signed
;
48 typedef unsigned long int mp_limb
;
49 typedef long int mp_limb_signed
;
53 typedef mp_limb
* mp_ptr
;
54 typedef __gmp_const mp_limb
* mp_srcptr
;
55 typedef int mp_size_t
;
56 typedef long int mp_exp_t
;
61 mp_size_t alloc
; /* Number of *limbs* allocated and pointed
63 mp_size_t size
; /* abs(SIZE) is the number of limbs
64 the last field points to. If SIZE
65 is negative this is a negative
67 mp_limb
*d
; /* Pointer to the limbs. */
72 short int alloc
; /* Number of *limbs* allocated and pointed
74 short int size
; /* abs(SIZE) is the number of limbs
75 the last field points to. If SIZE
76 is negative this is a negative
78 mp_limb
*d
; /* Pointer to the limbs. */
81 #endif /* __GNU_MP__ */
83 /* User-visible types. */
84 typedef __mpz_struct MP_INT
;
85 typedef __mpz_struct mpz_t
[1];
87 /* Structure for rational numbers. Zero is represented as 0/any, i.e.
88 the denominator is ignored. Negative numbers have the sign in
95 long int num_alloc
; /* Number of limbs allocated
97 long int num_size
; /* The absolute value of this field is the
98 length of the numerator; the sign is the
99 sign of the entire rational number. */
100 mp_ptr num
; /* Pointer to the numerator limbs. */
101 long int den_alloc
; /* Number of limbs allocated
102 for the denominator. */
103 long int den_size
; /* Length of the denominator. (This field
104 should always be positive.) */
105 mp_ptr den
; /* Pointer to the denominator limbs. */
109 typedef __mpq_struct MP_RAT
;
110 typedef __mpq_struct mpq_t
[1];
114 mp_size_t prec
; /* Max precision, in number of `mp_limb's.
115 Set by mpf_init and modified by
116 mpf_set_prec. The area pointed to
117 by the `d' field contains `prec' + 1
119 mp_size_t size
; /* abs(SIZE) is the number of limbs
120 the last field points to. If SIZE
121 is negative this is a negative
123 mp_exp_t exp
; /* Exponent, in the base of `mp_limb'. */
124 mp_limb
*d
; /* Pointer to the limbs. */
127 /* typedef __mpf_struct MP_FLOAT; */
128 typedef __mpf_struct mpf_t
[1];
130 /* Types for function declarations in gmp files. */
131 /* ??? Should not pollute user name space with these ??? */
132 typedef __gmp_const __mpz_struct
*mpz_srcptr
;
133 typedef __mpz_struct
*mpz_ptr
;
134 typedef __gmp_const __mpf_struct
*mpf_srcptr
;
135 typedef __mpf_struct
*mpf_ptr
;
136 typedef __gmp_const __mpq_struct
*mpq_srcptr
;
137 typedef __mpq_struct
*mpq_ptr
;
139 #if defined (__STDC__)
145 #if defined (FILE) || defined (_STDIO_H_) || defined (__STDIO_H__) || defined (H_STDIO)
146 #define _GMP_H_HAVE_FILE 1
149 void mp_set_memory_functions
_PROTO((void *(*) (size_t),
150 void *(*) (void *, size_t, size_t),
151 void (*) (void *, size_t)));
153 /**************** Integer (i.e. Z) routines. ****************/
155 void *_mpz_realloc
_PROTO ((mpz_ptr
, mp_size_t
));
157 void mpz_abs
_PROTO ((mpz_ptr
, mpz_srcptr
));
158 void mpz_add
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
159 void mpz_add_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
160 void mpz_and
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
161 void mpz_clear
_PROTO ((mpz_ptr
));
162 void mpz_clrbit
_PROTO ((mpz_ptr
, unsigned long int));
163 int mpz_cmp
_PROTO ((mpz_srcptr
, mpz_srcptr
));
164 int mpz_cmp_si
_PROTO ((mpz_srcptr
, signed long int));
165 int mpz_cmp_ui
_PROTO ((mpz_srcptr
, unsigned long int));
166 void mpz_com
_PROTO ((mpz_ptr
, mpz_srcptr
));
167 void mpz_div_2exp
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
168 void mpz_fac_ui
_PROTO ((mpz_ptr
, unsigned long int));
169 void mpz_gcd
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
170 unsigned long int mpz_gcd_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
171 void mpz_gcdext
_PROTO ((mpz_ptr
, mpz_ptr
, mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
172 /* signed */ long int mpz_get_si
_PROTO ((mpz_srcptr
));
173 char *mpz_get_str
_PROTO ((char *, int, mpz_srcptr
));
174 unsigned long int mpz_get_ui
_PROTO ((mpz_srcptr
));
175 mp_limb mpz_getlimbn
_PROTO ((mpz_srcptr
, mp_size_t
));
176 mp_size_t mpz_hamdist
_PROTO ((mpz_srcptr
, mpz_srcptr
));
177 void mpz_init
_PROTO ((mpz_ptr
));
178 #ifdef _GMP_H_HAVE_FILE
179 void mpz_inp_raw
_PROTO ((mpz_ptr
, FILE *));
180 int mpz_inp_str
_PROTO ((mpz_ptr
, FILE *, int));
182 void mpz_ior
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
183 void mpz_init_set
_PROTO ((mpz_ptr
, mpz_srcptr
));
184 void mpz_init_set_si
_PROTO ((mpz_ptr
, signed long int));
185 int mpz_init_set_str
_PROTO ((mpz_ptr
, const char *, int));
186 void mpz_init_set_ui
_PROTO ((mpz_ptr
, unsigned long int));
187 void mpz_lcm
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
188 void mpz_mod_2exp
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
189 void mpz_mul
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
190 void mpz_mul_2exp
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
191 void mpz_mul_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
192 void mpz_neg
_PROTO ((mpz_ptr
, mpz_srcptr
));
193 #ifdef _GMP_H_HAVE_FILE
194 void mpz_out_raw
_PROTO ((FILE *, mpz_srcptr
));
195 void mpz_out_str
_PROTO ((FILE *, int, mpz_srcptr
));
197 int mpz_perfect_square_p
_PROTO ((mpz_srcptr
));
198 mp_size_t mpz_popcount
_PROTO ((mpz_srcptr
));
199 void mpz_pow_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
200 void mpz_powm
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
, mpz_srcptr
));
201 void mpz_powm_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int, mpz_srcptr
));
202 int mpz_probab_prime_p
_PROTO ((mpz_srcptr
, int));
203 void mpz_random
_PROTO ((mpz_ptr
, mp_size_t
));
204 void mpz_random2
_PROTO ((mpz_ptr
, mp_size_t
));
205 void mpz_set
_PROTO ((mpz_ptr
, mpz_srcptr
));
206 void mpz_set_si
_PROTO ((mpz_ptr
, signed long int));
207 int mpz_set_str
_PROTO ((mpz_ptr
, const char *, int));
208 void mpz_set_ui
_PROTO ((mpz_ptr
, unsigned long int));
209 size_t mpz_size
_PROTO ((mpz_srcptr
));
210 size_t mpz_sizeinbase
_PROTO ((mpz_srcptr
, int));
211 void mpz_sqrt
_PROTO ((mpz_ptr
, mpz_srcptr
));
212 void mpz_sqrtrem
_PROTO ((mpz_ptr
, mpz_ptr
, mpz_srcptr
));
213 void mpz_sub
_PROTO ((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
214 void mpz_sub_ui
_PROTO ((mpz_ptr
, mpz_srcptr
, unsigned long int));
215 void mpz_ui_pow_ui
_PROTO ((mpz_ptr
, unsigned long int, unsigned long int));
217 void mpz_fdiv_q
_PROTO((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
218 unsigned long int mpz_fdiv_q_ui
_PROTO((mpz_ptr
, mpz_srcptr
, unsigned long int));
219 void mpz_fdiv_qr
_PROTO((mpz_ptr
, mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
220 unsigned long int mpz_fdiv_qr_ui
_PROTO((mpz_ptr
, mpz_ptr
, mpz_srcptr
, unsigned long int));
221 void mpz_fdiv_r
_PROTO((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
222 unsigned long int mpz_fdiv_r_ui
_PROTO((mpz_ptr
, mpz_srcptr
, unsigned long int));
223 unsigned long int mpz_fdiv_ui
_PROTO((mpz_srcptr
, unsigned long int));
224 void mpz_tdiv_q
_PROTO((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
225 void mpz_tdiv_q_ui
_PROTO((mpz_ptr
, mpz_srcptr
, unsigned long int));
226 void mpz_tdiv_qr
_PROTO((mpz_ptr
, mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
227 void mpz_tdiv_qr_ui
_PROTO((mpz_ptr
, mpz_ptr
, mpz_srcptr
, unsigned long int));
228 void mpz_tdiv_r
_PROTO((mpz_ptr
, mpz_srcptr
, mpz_srcptr
));
229 void mpz_tdiv_r_ui
_PROTO((mpz_ptr
, mpz_srcptr
, unsigned long int));
231 void mpz_array_init (mpz_ptr
, size_t, mp_size_t
);
233 /**************** Rational (i.e. Q) routines. ****************/
235 void mpq_init
_PROTO ((mpq_ptr
));
236 void mpq_clear
_PROTO ((mpq_ptr
));
237 void mpq_set
_PROTO ((mpq_ptr
, mpq_srcptr
));
238 void mpq_set_ui
_PROTO ((mpq_ptr
, unsigned long int, unsigned long int));
239 void mpq_set_si
_PROTO ((mpq_ptr
, signed long int, unsigned long int));
240 void mpq_add
_PROTO ((mpq_ptr
, mpq_srcptr
, mpq_srcptr
));
241 void mpq_sub
_PROTO ((mpq_ptr
, mpq_srcptr
, mpq_srcptr
));
242 void mpq_mul
_PROTO ((mpq_ptr
, mpq_srcptr
, mpq_srcptr
));
243 void mpq_div
_PROTO ((mpq_ptr
, mpq_srcptr
, mpq_srcptr
));
244 void mpq_neg
_PROTO ((mpq_ptr
, mpq_srcptr
));
245 int mpq_cmp
_PROTO ((mpq_srcptr
, mpq_srcptr
));
246 void mpq_inv
_PROTO ((mpq_ptr
, mpq_srcptr
));
247 void mpq_set_num
_PROTO ((mpq_ptr
, mpz_srcptr
));
248 void mpq_set_den
_PROTO ((mpq_ptr
, mpz_srcptr
));
249 void mpq_get_num
_PROTO ((mpz_ptr
, mpq_srcptr
));
250 void mpq_get_den
_PROTO ((mpz_ptr
, mpq_srcptr
));
252 /**************** Float (i.e. F) routines. ****************/
254 void mpf_abs
_PROTO ((mpf_ptr
, mpf_srcptr
));
255 void mpf_add
_PROTO ((mpf_ptr
, mpf_srcptr
, mpf_srcptr
));
256 void mpf_add_ui
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
257 void mpf_clear
_PROTO ((mpf_ptr
));
258 int mpf_cmp
_PROTO ((mpf_srcptr
, mpf_srcptr
));
259 int mpf_cmp_si
_PROTO ((mpf_srcptr
, long int));
260 int mpf_cmp_ui
_PROTO ((mpf_srcptr
, unsigned long int));
261 void mpf_div
_PROTO ((mpf_ptr
, mpf_srcptr
, mpf_srcptr
));
262 void mpf_div_2exp
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
263 void mpf_div_ui
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
264 void mpf_dump
_PROTO ((mpf_srcptr
));
265 char *mpf_get_str
_PROTO ((char *, mp_exp_t
*, int, size_t, mpf_srcptr
));
266 void mpf_init
_PROTO ((mpf_ptr
));
267 void mpf_init2
_PROTO ((mpf_ptr
, mp_size_t
));
268 #ifdef _GMP_H_HAVE_FILE
269 void mpf_inp_str
_PROTO ((mpf_ptr
, FILE *, int));
271 void mpf_init_set
_PROTO ((mpf_ptr
, mpf_srcptr
));
272 void mpf_init_set_d
_PROTO ((mpf_ptr
, double));
273 void mpf_init_set_si
_PROTO ((mpf_ptr
, long int));
274 int mpf_init_set_str
_PROTO ((mpf_ptr
, char *, int));
275 void mpf_init_set_ui
_PROTO ((mpf_ptr
, unsigned long int));
276 void mpf_mul
_PROTO ((mpf_ptr
, mpf_srcptr
, mpf_srcptr
));
277 void mpf_mul_2exp
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
278 void mpf_mul_ui
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
279 void mpf_neg
_PROTO ((mpf_ptr
, mpf_srcptr
));
280 #ifdef _GMP_H_HAVE_FILE
281 void mpf_out_str
_PROTO ((mpf_ptr
, int, size_t, FILE *));
283 void mpf_set
_PROTO ((mpf_ptr
, mpf_srcptr
));
284 void mpf_set_d
_PROTO ((mpf_ptr
, double));
285 mp_size_t mpf_set_default_prec
_PROTO ((mp_size_t
));
286 void mpf_set_si
_PROTO ((mpf_ptr
, long int));
287 int mpf_set_str
_PROTO ((mpf_ptr
, const char *, int));
288 void mpf_set_ui
_PROTO ((mpf_ptr
, unsigned long int));
289 size_t mpf_size
_PROTO ((mpf_srcptr
));
290 void mpf_sqrt
_PROTO ((mpf_ptr
, mpf_srcptr
));
291 void mpf_sqrt_ui
_PROTO ((mpf_ptr
, unsigned long int));
292 void mpf_sub
_PROTO ((mpf_ptr
, mpf_srcptr
, mpf_srcptr
));
293 void mpf_sub_ui
_PROTO ((mpf_ptr
, mpf_srcptr
, unsigned long int));
294 void mpf_ui_div
_PROTO ((mpf_ptr
, unsigned long int, mpf_srcptr
));
296 /************ Low level positive-integer (i.e. N) routines. ************/
298 /* This is ugly, but we need to make usr calls reach the prefixed function. */
299 #define mpn_add_n __mpn_add_n
300 #define mpn_sub_n __mpn_sub_n
301 #define mpn_mul_1 __mpn_mul_1
302 #define mpn_addmul_1 __mpn_addmul_1
303 #define mpn_submul_1 __mpn_submul_1
304 #define mpn_lshift __mpn_lshift
305 #define mpn_rshift __mpn_rshift
306 #define mpn_sub __mpn_sub
307 #define mpn_add __mpn_add
308 #define mpn_normal_size __mpn_normal_size
309 #define mpn_cmp __mpn_cmp
310 #define mpn_add_1 __mpn_add_1
311 #define mpn_sub_1 __mpn_sub_1
312 #define mpn_mul_n __mpn_mul_n
313 #define mpn_mul __mpn_mul
314 #define mpn_divmod __mpn_divmod
315 #define mpn_divmod_1 __mpn_divmod_1
316 #define mpn_mod_1 __mpn_mod_1
317 #define mpn_sqrt __mpn_sqrt
318 #define mpn_next_bit_set __mpn_next_bit_set
319 #define mpn_popcount __mpn_popcount
320 #define mpn_hamdist __mpn_hamdist
321 #define mpn_random2 __mpn_random2
322 #define mpn_set_str __mpn_set_str
323 #define mpn_get_str __mpn_get_str
324 #define mpn_gcd_1 __mpn_gcd_1
326 mp_limb __mpn_add_n
_PROTO ((mp_ptr
, mp_srcptr
, mp_srcptr
, mp_size_t
));
327 mp_limb __mpn_sub_n
_PROTO ((mp_ptr
, mp_srcptr
, mp_srcptr
, mp_size_t
));
328 mp_limb __mpn_mul
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, mp_srcptr
, mp_size_t
));
329 void __mpn_mul_n
_PROTO ((mp_ptr
, mp_srcptr
, mp_srcptr
, mp_size_t
));
330 mp_limb __mpn_mul_1
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, mp_limb
));
331 mp_limb __mpn_addmul_1
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, mp_limb
));
332 mp_limb __mpn_submul_1
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, mp_limb
));
333 mp_limb __mpn_divmod
_PROTO ((mp_ptr
, mp_ptr
, mp_size_t
, mp_srcptr
, mp_size_t
));
334 mp_limb __mpn_divmod_1
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, mp_limb
));
335 mp_limb __mpn_mod_1
_PROTO ((mp_srcptr
, mp_size_t
, mp_limb
));
336 mp_limb __mpn_lshift
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, unsigned int));
337 mp_limb __mpn_rshift
_PROTO ((mp_ptr
, mp_srcptr
, mp_size_t
, unsigned int));
338 mp_size_t __mpn_sqrt
_PROTO ((mp_ptr
, mp_ptr
, mp_srcptr
, mp_size_t
));
339 int __mpn_cmp
_PROTO ((mp_srcptr
, mp_srcptr
, mp_size_t
));
340 mp_size_t __mpn_next_bit_set
_PROTO ((mp_srcptr
, mp_size_t
));
341 mp_size_t __mpn_popcount
_PROTO ((mp_srcptr
, mp_size_t
));
342 mp_size_t __mpn_hamdist
_PROTO ((mp_srcptr
, mp_srcptr
, mp_size_t
));
343 void __mpn_random2
_PROTO ((mp_ptr
, mp_size_t
));
344 mp_size_t __mpn_set_str
_PROTO ((mp_ptr
, const unsigned char *, size_t, int));
345 size_t __mpn_get_str
_PROTO ((unsigned char *, int, mp_ptr
, mp_size_t
));
346 mp_limb __mpn_gcd_1
_PROTO ((mp_srcptr
, mp_size_t
, mp_limb
));
349 static __gmp_inline mp_limb
350 #if defined (__STDC__)
351 __mpn_add_1 (register mp_ptr res_ptr
,
352 register mp_srcptr s1_ptr
,
353 register mp_size_t s1_size
,
354 register mp_limb s2_limb
)
356 __mpn_add_1 (res_ptr
, s1_ptr
, s1_size
, s2_limb
)
357 register mp_ptr res_ptr
;
358 register mp_srcptr s1_ptr
;
359 register mp_size_t s1_size
;
360 register mp_limb s2_limb
;
366 s2_limb
= x
+ s2_limb
;
367 *res_ptr
++ = s2_limb
;
370 while (--s1_size
!= 0)
382 if (res_ptr
!= s1_ptr
)
385 for (i
= 0; i
< s1_size
- 1; i
++)
386 res_ptr
[i
] = s1_ptr
[i
];
391 static __gmp_inline mp_limb
392 #if defined (__STDC__)
393 __mpn_add (register mp_ptr res_ptr
,
394 register mp_srcptr s1_ptr
,
395 register mp_size_t s1_size
,
396 register mp_srcptr s2_ptr
,
397 register mp_size_t s2_size
)
399 __mpn_add (res_ptr
, s1_ptr
, s1_size
, s2_ptr
, s2_size
)
400 register mp_ptr res_ptr
;
401 register mp_srcptr s1_ptr
;
402 register mp_size_t s1_size
;
403 register mp_srcptr s2_ptr
;
404 register mp_size_t s2_size
;
410 cy_limb
= __mpn_add_n (res_ptr
, s1_ptr
, s2_ptr
, s2_size
);
412 if (s1_size
- s2_size
!= 0)
413 cy_limb
= __mpn_add_1 (res_ptr
+ s2_size
,
420 static __gmp_inline mp_limb
421 #if defined (__STDC__)
422 __mpn_sub_1 (register mp_ptr res_ptr
,
423 register mp_srcptr s1_ptr
,
424 register mp_size_t s1_size
,
425 register mp_limb s2_limb
)
427 __mpn_sub_1 (res_ptr
, s1_ptr
, s1_size
, s2_limb
)
428 register mp_ptr res_ptr
;
429 register mp_srcptr s1_ptr
;
430 register mp_size_t s1_size
;
431 register mp_limb s2_limb
;
437 s2_limb
= x
- s2_limb
;
438 *res_ptr
++ = s2_limb
;
441 while (--s1_size
!= 0)
453 if (res_ptr
!= s1_ptr
)
456 for (i
= 0; i
< s1_size
- 1; i
++)
457 res_ptr
[i
] = s1_ptr
[i
];
462 static __gmp_inline mp_limb
463 #if defined (__STDC__)
464 __mpn_sub (register mp_ptr res_ptr
,
465 register mp_srcptr s1_ptr
,
466 register mp_size_t s1_size
,
467 register mp_srcptr s2_ptr
,
468 register mp_size_t s2_size
)
470 __mpn_sub (res_ptr
, s1_ptr
, s1_size
, s2_ptr
, s2_size
)
471 register mp_ptr res_ptr
;
472 register mp_srcptr s1_ptr
;
473 register mp_size_t s1_size
;
474 register mp_srcptr s2_ptr
;
475 register mp_size_t s2_size
;
481 cy_limb
= __mpn_sub_n (res_ptr
, s1_ptr
, s2_ptr
, s2_size
);
483 if (s1_size
- s2_size
!= 0)
484 cy_limb
= __mpn_sub_1 (res_ptr
+ s2_size
,
491 static __gmp_inline mp_size_t
492 #if defined (__STDC__)
493 __mpn_normal_size (mp_srcptr ptr
, mp_size_t size
)
495 __mpn_normal_size (ptr
, size
)
509 /* Compatibility with GMP 1. */
511 #define mpz_mdiv mpz_fdiv_q
512 #define mpz_mdivmod mpz_fdiv_qr
513 #define mpz_mmod mpz_fdiv_r
514 #define mpz_mdiv_ui mpz_fdiv_q_ui
515 #define mpz_mdivmod_ui(q,r,n,d) \
516 ((r == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
517 #define mpz_mmod_ui(r,n,d) \
518 ((r == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
519 /* ??? Before release...
520 #define mpz_div_2exp mpz_fdiv_q_2exp
521 #define mpz_mod_2exp mpz_fdiv_r_2exp
524 /* Useful synonyms, but not quite compatible with GMP 1. */
525 #define mpz_div mpz_fdiv_q
526 #define mpz_divmod mpz_fdiv_qr
527 #define mpz_div_ui mpz_fdiv_q_ui
528 #define mpz_divmod_ui mpz_fdiv_qr_ui
529 #define mpz_mod_ui mpz_fdiv_r_ui
533 #define __GNU_MP_VERSION 2
534 #define __GNU_MP_VERSION_MINOR -900 /* ??? */
536 #endif /* __GMP_H__ */