From bc7ca8c9fd85be32ef09b22b99941f0e81b86e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Tue, 13 Aug 1996 12:37:50 +0200 Subject: [PATCH] should now work with older versions of GMP Rev: src/modules/gmpmod/configure.in:1.4 Rev: src/modules/gmpmod/gmp_machine.h.in:1.3 Rev: src/modules/gmpmod/mpz_glue.c:1.4 --- src/modules/gmpmod/configure.in | 16 ---------------- src/modules/gmpmod/gmp_machine.h.in | 3 --- src/modules/gmpmod/mpz_glue.c | 13 +++++-------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/modules/gmpmod/configure.in b/src/modules/gmpmod/configure.in index 9cecf8fc30..b8c1fa3b4a 100644 --- a/src/modules/gmpmod/configure.in +++ b/src/modules/gmpmod/configure.in @@ -8,22 +8,6 @@ AC_SUBST(RANLIB) AC_CHECK_HEADERS(gmp.h) AC_CHECK_LIB(gmp, mpz_set_si) -AC_MSG_CHECKING(if libgmp is new enough) -AC_CACHE_VAL(lpc_cv_lib_gmp_is_new_enough, -[ -AC_TRY_COMPILE([#include <gmp.h>],[ -mpz_t foo; -return 0; -],lpc_cv_lib_gmp_is_new_enough=yes,lpc_cv_lib_gmp_is_new_enough=no) -]) - -if test "$lpc_cv_lib_gmp_is_new_enough" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_NEW_GMP) -else - AC_MSG_RESULT(no) -fi - AC_OUTPUT(Makefile,echo FOO >stamp-h ) diff --git a/src/modules/gmpmod/gmp_machine.h.in b/src/modules/gmpmod/gmp_machine.h.in index d53e0cbc1c..0a79aef13b 100644 --- a/src/modules/gmpmod/gmp_machine.h.in +++ b/src/modules/gmpmod/gmp_machine.h.in @@ -4,7 +4,4 @@ /* Define this if you have <gmp.h> */ #undef HAVE_GMP_H -/* Define this if your gmp is version 2.0 or newer */ -#undef HAVE_NEW_GMP - #endif diff --git a/src/modules/gmpmod/mpz_glue.c b/src/modules/gmpmod/mpz_glue.c index 5c2e502ec9..944861b340 100644 --- a/src/modules/gmpmod/mpz_glue.c +++ b/src/modules/gmpmod/mpz_glue.c @@ -7,10 +7,6 @@ #include "gmp_machine.h" #include "types.h" -#ifndef HAVE_NEW_GMP -#undef HAVE_GMP_H -#endif - #ifdef HAVE_GMP_H #include "interpret.h" @@ -25,12 +21,13 @@ #include <gmp.h> -#define THIS (*(mpz_t *)(fp->current_storage)) -#define OBTOMPZ(o) (*(mpz_t *)(o->storage)) + +#define THIS (*(MP_INT **)(fp->current_storage)) +#define OBTOMPZ(o) (*(MP_INT **)(o->storage)) static struct program *mpzmod_program; -static void get_new_mpz(mpz_t tmp, struct svalue *s) +static void get_new_mpz(MP_INT *tmp, struct svalue *s) { switch(s->type) { @@ -392,7 +389,7 @@ void init_gmpmod_programs(void) { #ifdef HAVE_GMP_H start_new_program(); - add_storage(sizeof(mpz_t)); + add_storage(sizeof(MP_INT *)); add_function("create",mpzmod_create,"function(void|string|int|float|object:void)",0); -- GitLab