Fixed some GMP issues with long being 32 bit on Windows 64 bit by introducing new level of indirection gmp_long to be __int64 in the above case and long otherwise

This commit is contained in:
syakovyn 2011-11-11 21:29:22 +02:00 committed by Juan Jose Garcia Ripoll
parent fd5488269b
commit 13ff478d41
3 changed files with 16 additions and 5 deletions

View file

@ -26,6 +26,7 @@ MA 02110-1301, USA. */
#include <iosfwd> /* for std::istream, std::ostream, std::string */
#endif
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
# if defined( _MSC_VER )
@ -188,6 +189,16 @@ MA 02110-1301, USA. */
#define __GMP_DECLSPEC
#endif
/* In order to overcome issue with LL64 vias L64 on Windows 64 the next level
of indirection is introduced: gmp_long instead of long
*/
#ifdef _WIN64
#define gmp_long __int64
#else
#define typedef gmp_long long
#endif
#ifdef __GMP_SHORT_LIMB
typedef unsigned int mp_limb_t;
@ -1056,7 +1067,7 @@ __GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
#endif
#define mpz_set_si __gmpz_set_si
__GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, signed long int));
__GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, gmp_long));
#define mpz_set_str __gmpz_set_str
__GMP_DECLSPEC int mpz_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));

View file

@ -28,7 +28,7 @@ MA 02110-1301, USA. */
#ifdef OPERATION_mul_si
#define FUNCTION mpz_mul_si
#define MULTIPLICAND_UNSIGNED
#define MULTIPLICAND_ABS(x) ((unsigned long) ABS(x))
#define MULTIPLICAND_ABS(x) ((unsigned gmp_long) ABS(x))
#endif
#ifdef OPERATION_mul_ui
@ -44,7 +44,7 @@ Error, error, unrecognised OPERATION
void
FUNCTION (mpz_ptr prod, mpz_srcptr mult,
MULTIPLICAND_UNSIGNED long int small_mult)
MULTIPLICAND_UNSIGNED gmp_long small_mult)
{
mp_size_t size = SIZ(mult);
mp_size_t sign_product = size;

View file

@ -24,12 +24,12 @@ MA 02110-1301, USA. */
#include "gmp-impl.h"
void
mpz_set_si (mpz_ptr dest, signed long int val)
mpz_set_si (mpz_ptr dest, gmp_long val)
{
mp_size_t size;
mp_limb_t vl;
vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
vl = (mp_limb_t) (unsigned gmp_long) (val >= 0 ? val : -val);
dest->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;