Branch: Tag:

2008-05-01

2008-05-01 21:14:04 by Martin Stjernholm <mast@lysator.liu.se>

Converting between bignums and unsigned is useful even when there's no
support for INT64 (which otoh do seem a bit rare in this day and age), so
changed the uint64 functions to ulongest.

Rev: src/bignum.c:1.44
Rev: src/bignum.h:1.33
Rev: src/modules/Gmp/mpz_glue.c:1.176
Rev: src/modules/Gmp/my_gmp.h:1.26

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: bignum.c,v 1.43 2008/05/01 20:50:02 mast Exp $ + || $Id: bignum.c,v 1.44 2008/05/01 21:14:04 mast Exp $   */      #include "global.h"
135: Inside #if defined(INT64)
  }      PMOD_EXPORT void (*push_int64) (INT64) = bootstrap_push_int64; - PMOD_EXPORT void (*push_uint64) (unsigned INT64) = NULL; +    PMOD_EXPORT int (*int64_from_bignum) (INT64 *, struct object *) = NULL; - PMOD_EXPORT int (*uint64_from_bignum) (unsigned INT64 *, struct object *)=NULL; +    PMOD_EXPORT void (*reduce_stack_top_bignum) (void) = NULL; -  + #endif    - PMOD_EXPORT void hook_in_int64_funcs ( + PMOD_EXPORT void (*push_ulongest) (unsigned LONGEST) = NULL; + PMOD_EXPORT int (*ulongest_from_bignum) (unsigned LONGEST *, +  struct object *) = NULL; +  + PMOD_EXPORT void hook_in_gmp_funcs ( + #ifdef INT64    void (*push_int64_val)(INT64), -  void (*push_uint64_val) (unsigned INT64), +     int (*int64_from_bignum_val) (INT64 *, struct object *), -  int (*uint64_from_bignum_val) (unsigned INT64 *, struct object *), -  void (*reduce_stack_top_bignum_val) (void)) +  void (*reduce_stack_top_bignum_val) (void), + #endif +  void (*push_ulongest_val) (unsigned LONGEST), +  int (*ulongest_from_bignum_val) (unsigned LONGEST *, struct object *))   {    /* Assigning the pointers above directly from the Gmp module doesn't    * work in some cases, e.g. NT. */ -  + #ifdef INT64    push_int64 = push_int64_val ? push_int64_val : bootstrap_push_int64; -  push_uint64 = push_uint64_val; +     int64_from_bignum = int64_from_bignum_val; -  uint64_from_bignum = uint64_from_bignum_val; +     reduce_stack_top_bignum = reduce_stack_top_bignum_val; - } +    #endif -  +  push_ulongest = push_ulongest_val; +  ulongest_from_bignum = ulongest_from_bignum_val; + }      #endif /* AUTO_BIGNUM */