Branch: Tag:

2003-04-02

2003-04-02 00:38:31 by Martin Stjernholm <mast@lysator.liu.se>

Fixed initialization of the int64/bignum pointers on systems where it
apparently doesn't work to assign function pointers in other modules, e.g.
NT.

Rev: src/bignum.c:1.38
Rev: src/bignum.h:1.23
Rev: src/modules/Gmp/mpz_glue.c:1.138

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: mpz_glue.c,v 1.137 2003/03/29 17:14:22 grubba Exp $ + || $Id: mpz_glue.c,v 1.138 2003/04/02 00:38:31 mast Exp $   */      #include "global.h" - RCSID("$Id: mpz_glue.c,v 1.137 2003/03/29 17:14:22 grubba Exp $"); + RCSID("$Id: mpz_glue.c,v 1.138 2003/04/02 00:38:31 mast Exp $");   #include "gmp_machine.h"   #include "module.h"   
143: Inside #if defined(INT64)
   ((SIZEOF_INT64 + SIZEOF_LONG - 1) / SIZEOF_LONG - 1)    /* The above is the position of the top unsigned long in the INT64. */    * ULONG_BITS; -  mpz_set_ui (mpz, (i >> n) & ULONG_MAX); +  mpz_set_ui (mpz, (unsigned long) (i >> n));    while (n) {    n -= ULONG_BITS;    mpz_mul_2exp (mpz, mpz, ULONG_BITS); -  mpz_add_ui (mpz, mpz, (i >> n) & ULONG_MAX); +  mpz_add_ui (mpz, mpz, (unsigned long) (i >> n));    }    }   #endif
308:    ((SIZEOF_INT_TYPE + SIZEOF_LONG - 1) / SIZEOF_LONG - 1)    /* The above is the position of the top unsigned long in the INT_TYPE. */    * ULONG_BITS; -  mpz_set_ui (tmp, (i >> n) & ULONG_MAX); +  mpz_set_ui (tmp, (unsigned long) (i >> n));    while (n) {    n -= ULONG_BITS;    mpz_mul_2exp (tmp, tmp, ULONG_BITS); -  mpz_add_ui (tmp, tmp, (i >> n) & ULONG_MAX); +  mpz_add_ui (tmp, tmp, (unsigned long) (i >> n));    }    }   #endif
1724: Inside #if defined(USE_GMP) || defined(USE_GMP2), #if defined(AUTO_BIGNUM) and #if defined(INT64)
   mpz_clear (mpz_int_type_min);   #ifdef INT64    mpz_clear (mpz_int64_min); -  push_int64 = bootstrap_push_int64; -  int64_from_bignum = NULL; +  hook_in_int64_funcs (NULL, NULL);   #endif    }   #endif
1886: Inside #if defined(INT64)
   mpz_init (mpz_int64_min);    mpz_setbit (mpz_int64_min, INT64_BITS);    mpz_neg (mpz_int64_min, mpz_int64_min); -  push_int64 = gmp_push_int64; -  int64_from_bignum = gmp_int64_from_bignum; +  hook_in_int64_funcs (gmp_push_int64, gmp_int64_from_bignum);   #endif      #if 0