pike.git / src / modules / Gmp / mpz_glue.c

version» Context lines:

pike.git/src/modules/Gmp/mpz_glue.c:354:    }   #endif       *i = res;    return 1;    }       return 0;   }    + PMOD_EXPORT void gmp_ulongest_to_svalue_no_free(struct svalue *sv, UINT64 i) + { +  if (i <= MAX_INT_TYPE) { +  SET_SVAL(*sv, PIKE_T_INT, NUMBER_NUMBER, integer, (INT_TYPE)i); +  } +  else { +  MP_INT *mpz; +  +  SET_SVAL(*sv, PIKE_T_OBJECT, 0, object, fast_clone_object(bignum_program)); +  mpz = OBTOMPZ(sv->u.object); + #if SIZEOF_LONG >= SIZEOF_INT64 +  mpz_set_ui (mpz, i); + #else +  mpz_import (mpz, 1, 1, SIZEOF_INT64, 0, 0, &i); + #endif /* SIZEOF_LONG < SIZEOF_INT64 */ +  } + } +    /*! @module Gmp    *! GMP is a free library for arbitrary precision arithmetic,    *! operating on signed integers, rational numbers, and floating point    *! numbers. There is no practical limit to the precision except the    *! ones implied by the available memory in the machine GMP runs on.    *! @url{http://www.swox.com/gmp/@}    */      /*! @class bignum    *! This program is used by the internal auto-bignum conversion. It
pike.git/src/modules/Gmp/mpz_glue.c:2230: Inside #if defined(USE_GMP) || defined(USE_GMP2)
   {    free_program(bignum_program);    bignum_program=0;    }    mpz_clear (mpz_int_type_min);   #ifdef INT64    mpz_clear (mpz_int64_min);   #endif    hook_in_gmp_funcs (   #ifdef INT64 -  NULL, NULL, NULL, +  NULL, NULL, NULL, NULL,   #endif    NULL, NULL, NULL, NULL);   #endif   }      static void *pike_mp_alloc (size_t alloc_size)   {    void *ret = malloc (alloc_size);    if (!ret)    /* According to gmp docs, we're neither allowed to return zero nor
pike.git/src/modules/Gmp/mpz_glue.c:2443:    SET_SVAL(auto_bignum_program, PIKE_T_PROGRAM, 0, program, bignum_program);    add_ref(bignum_program);      #ifdef INT64    mpz_init (mpz_int64_min);    mpz_setbit (mpz_int64_min, INT64_BITS);    mpz_neg (mpz_int64_min, mpz_int64_min);   #endif    hook_in_gmp_funcs (   #ifdef INT64 -  gmp_push_int64, gmp_int64_from_bignum, -  gmp_reduce_stack_top_bignum, +  gmp_push_int64, gmp_ulongest_to_svalue_no_free, +  gmp_int64_from_bignum, gmp_reduce_stack_top_bignum,   #endif    gmp_push_ulongest, gmp_ulongest_from_bignum,    gmp_mpz_from_svalue, gmp_push_bignum);   #endif       pike_init_mpq_module();    pike_init_mpf_module();   }      /*! @endmodule    */