Branch: Tag:

2003-04-02

2003-04-02 21:20:19 by Martin Stjernholm <mast@lysator.liu.se>

Optimized gmp_push_int64 in case sizeof(long) >= sizeof(INT64).

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

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.139 2003/04/02 19:29:21 nilsson Exp $ + || $Id: mpz_glue.c,v 1.140 2003/04/02 21:20:19 mast Exp $   */      #include "global.h" - RCSID("$Id: mpz_glue.c,v 1.139 2003/04/02 19:29:21 nilsson Exp $"); + RCSID("$Id: mpz_glue.c,v 1.140 2003/04/02 21:20:19 mast Exp $");   #include "gmp_machine.h"   #include "module.h"   
129: Inside #if defined(INT64)
   else    {    MP_INT *mpz; -  int neg = i < 0; -  if (neg) i = -i; +        push_object (fast_clone_object (bignum_program));    mpz = OBTOMPZ (sp[-1].u.object);    -  + #if SIZEOF_LONG >= SIZEOF_INT64 +  mpz_set_si (mpz, i); + #else +  { +  int neg = i < 0; +  if (neg) i = -i; +    #ifdef HAVE_MPZ_IMPORT    mpz_import (mpz, 1, 1, SIZEOF_INT64, 0, 0, &i);   #else
150: Inside #if defined(INT64)
   mpz_add_ui (mpz, mpz, (unsigned long) (i >> n));    }    } - #endif + #endif /* !HAVE_MPZ_IMPORT */       if (neg) mpz_neg (mpz, mpz); -  + #endif /* SIZEOF_LONG < SIZEOF_INT64 */    }    } -  + }      static mpz_t mpz_int64_min;