pike.git / src / bignum.c

version» Context lines:

pike.git/src/bignum.c:1:   /*   || 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.32 2003/01/27 10:18:25 mirar Exp $ + || $Id: bignum.c,v 1.33 2003/02/14 19:19:57 mast Exp $   */      #include "global.h"      #ifdef AUTO_BIGNUM      #include "interpret.h"   #include "program.h"   #include "object.h"   #include "svalue.h"
pike.git/src/bignum.c:39:   void exit_auto_bignum(void)   {    free_svalue(&auto_bignum_program);    auto_bignum_program.type=T_INT;   }      PMOD_EXPORT void convert_stack_top_to_bignum(void)   {    apply_svalue(&auto_bignum_program, 1);    -  if(sp[-1].type != T_OBJECT) +  if(sp[-1].type != T_OBJECT) {    if (auto_bignum_program.type!=T_PROGRAM)    Pike_error("Gmp.mpz conversion failed (Gmp.bignum not loaded).\n");    else    Pike_error("Gmp.mpz conversion failed (unknown error).\n");    } -  + }      PMOD_EXPORT void convert_stack_top_with_base_to_bignum(void)   {    apply_svalue(&auto_bignum_program, 2);    -  if(sp[-1].type != T_OBJECT) +  if(sp[-1].type != T_OBJECT) {    if (auto_bignum_program.type!=T_PROGRAM)    Pike_error("Gmp.mpz conversion failed (Gmp.bignum not loaded).\n");    else    Pike_error("Gmp.mpz conversion failed (unknown error).\n");    } -  + }      int is_bignum_object(struct object *o)   {    /* Note:    * This function should *NOT* try to resolv Gmp.mpz unless    * it is already loaded into memory.    * /Hubbe    */       if (auto_bignum_program.type == T_INT)
pike.git/src/bignum.c:144: Inside #if defined(INT64) and #if PIKE_BYTEORDER == 1234
   digits[1] = ledigits[ 6 ]; digits[0] = ledigits[ 7 ];    push_string( make_shared_binary_string( digits, 8 ) );    }   #else    push_string( make_shared_binary_string( (char *)&i, 8 ) );   #endif    push_int( 256 );    apply_svalue(&auto_bignum_program, 2);       -  if(neg) +  if(neg) {    apply_low(sp[-1].u.object,FIND_LFUN(sp[-1].u.object->prog,LFUN_COMPL),0); -  +  stack_pop_n_elems_keep_top(1);    }    } -  + }      /* This routines can be optimized quite drastically. */   #define BIGNUM_INT64_MASK 0xffffff   #define BIGNUM_INT64_SHIFT 24   PMOD_EXPORT int int64_from_bignum(INT64 *i, struct object *bignum)   {    int neg, pos, rshfun, andfun;       *i = 0;