pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:1710:    }    }    r = realloc_unlinked_string(r, SUBTRACT_PCHARP(buf, MKPCHARP_STR(r)));    r = low_end_shared_string(r);    pop_n_elems(args);    push_string(r);    break;    }       case BIT_INT: +  {   #ifdef AUTO_BIGNUM -  +  int of = 0;    size = 0;    for(e = -args; e < 0; e++)    { -  if(INT_TYPE_ADD_OVERFLOW(sp[e].u.integer, size)) +  size = DO_INT_TYPE_ADD_OVERFLOW(size, sp[e].u.integer, &of); +  } +  if(of)    {    convert_svalue_to_bignum(sp-args);    f_add(args);    return;    } -  else -  { -  size += sp[e].u.integer; -  } -  } +     sp-=args;    push_int(size);   #else    size=0;    for(e=-args; e<0; e++) size+=sp[e].u.integer;    sp-=args-1;    SET_SVAL(sp[-1], PIKE_T_INT, NUMBER_NUMBER, integer, size);   #endif /* AUTO_BIGNUM */    break;    -  +  }    case BIT_FLOAT:    if (args > 2) {    /* Attempt to minimize the accumulated summation error    * by adding the smallest (absolute) values first.    *    * Large accumulated errors can occur eg when the number    * of values to add is of the same order as the largest    * number representable by the mantissa alone. ie when    * the sum differs by an order of magnitude from a    * typical term.
pike.git/src/operators.c:3732:    return;       case TWO_TYPES(T_INT,T_FLOAT):    sp--;    sp[-1].u.float_number=    (FLOAT_TYPE) sp[-1].u.integer * sp[0].u.float_number;    SET_SVAL_TYPE(sp[-1], T_FLOAT);    return;       case TWO_TYPES(T_INT,T_INT): - #ifdef AUTO_BIGNUM -  if(INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer)) +     { -  +  INT_TYPE res; + #ifndef AUTO_BIGNUM +  res = sp[-2].u.integer * sp[-1].u.integer; + #else +  int of = 0; +  +  res = DO_INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer, &of); +  +  if(of) +  {    convert_stack_top_to_bignum();    goto do_lfun_multiply;    }   #endif /* AUTO_BIGNUM */    sp--; -  SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, -  sp[-1].u.integer * sp[0].u.integer); +  SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, res);    return; -  +  }    default:    do_lfun_multiply:    if(call_lfun(LFUN_MULTIPLY, LFUN_RMULTIPLY))    return;       PIKE_ERROR("`*", "Bad arguments.\n", sp, 2);    }   }      /*! @decl mixed `*(mixed arg1)