Branch: Tag:

2003-03-28

2003-03-28 16:30:46 by Martin Stjernholm <mast@lysator.liu.se>

Some mostly theoretical fixes.

Rev: src/modules/Gmp/mpz_glue.c:1.129

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.128 2003/03/28 15:51:40 mast Exp $ + || $Id: mpz_glue.c,v 1.129 2003/03/28 16:30:46 mast Exp $   */      #include "global.h" - RCSID("$Id: mpz_glue.c,v 1.128 2003/03/28 15:51:40 mast Exp $"); + RCSID("$Id: mpz_glue.c,v 1.129 2003/03/28 16:30:46 mast Exp $");   #include "gmp_machine.h"   #include "module.h"   
76: Inside #if defined(AUTO_BIGNUM)
   INT_TYPE res = 0;       /* Get the index of the highest limb that have bits within the range -  * of the INT64. */ +  * of the INT_TYPE. */    size_t pos = (INT_TYPE_BITS + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS - 1;       if (mpz_size (mpz) <= pos + 1) {   #if INT_TYPE_BITS == GMP_NUMB_BITS -  res = mpz_getlimbn (mpz, 0); +  res = mpz_getlimbn (mpz, 0) & GMP_NUMB_MASK;   #elif INT_TYPE_BITS < GMP_NUMB_BITS -  mp_limb_t val = mpz_getlimbn (mpz, 0); +  mp_limb_t val = mpz_getlimbn (mpz, 0) & GMP_NUMB_MASK;    if (val >= (mp_limb_t) 1 << INT_TYPE_BITS) goto overflow;    res = val;   #else
174:       if (mpz_size (mpz) <= pos + 1) {   #if INT64_BITS == GMP_NUMB_BITS -  res = mpz_getlimbn (mpz, 0); +  res = mpz_getlimbn (mpz, 0) & GMP_NUMB_MASK;   #elif INT64_BITS < GMP_NUMB_BITS -  mp_limb_t val = mpz_getlimbn (mpz, 0); +  mp_limb_t val = mpz_getlimbn (mpz, 0) & GMP_NUMB_MASK;    if (val >= (mp_limb_t) 1 << INT64_BITS) goto overflow;    res = val;   #else