Skip to content

Commit

Permalink
Add GMP compatibility defines and gmp_errno to MPIR
Browse files Browse the repository at this point in the history
  • Loading branch information
(no author) committed Mar 12, 2010
1 parent f228e88 commit fee55d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion errno.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This file is part of the GNU MP Library.
The GNU MP 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 2.1 of the License, or (at your
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MP Library is distributed in the hope that it will be useful, but
Expand All @@ -27,6 +27,7 @@ MA 02110-1301, USA. */
#include "mpir.h"
#include "gmp-impl.h"

int gmp_errno = 0;

/* The deliberate divide by zero triggers an exception on most systems. On
those where it doesn't, for example power and powerpc, use abort instead.
Expand Down
10 changes: 10 additions & 0 deletions gmp-h.in
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ __GMP_DECLSPEC void mp_get_memory_functions __GMP_PROTO ((void *(**) (size_t),
#define mp_bits_per_limb __gmp_bits_per_limb
__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;

#define gmp_errno __gmp_errno
__GMP_DECLSPEC extern int gmp_errno;

#define gmp_version __gmp_version
__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;

Expand Down Expand Up @@ -2334,6 +2337,13 @@ __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
#endif

#define mpz_div mpz_fdiv_q
#define mpz_divmod mpz_fdiv_qr
#define mpz_div_ui mpz_fdiv_q_ui
#define mpz_divmod_ui mpz_fdiv_qr_ui
#define mpz_div_2exp mpz_fdiv_q_2exp
#define mpz_mod_2exp mpz_fdiv_r_2exp

enum
{
GMP_ERROR_NONE = 0,
Expand Down

0 comments on commit fee55d4

Please sign in to comment.