pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h"   #include <math.h> - RCSID("$Id: operators.c,v 1.62 1999/10/09 23:29:01 hubbe Exp $"); + RCSID("$Id: operators.c,v 1.63 1999/10/15 21:08:44 noring Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"   #include "mapping.h"   #include "array.h"   #include "stralloc.h"   #include "opcodes.h"   #include "operators.h"   #include "language.h"   #include "pike_memory.h"
pike.git/src/operators.c:668:    push_multiset(l);    return;    }       case T_FLOAT:    sp--;    sp[-1].u.float_number -= sp[0].u.float_number;    return;       case T_INT: + #ifdef AUTO_BIGNUM +  if(INT_TYPE_SUB_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer)) +  { +  convert_stack_top_to_bignum(); +  f_minus(2); +  return; +  } + #endif /* AUTO_BIGNUM */    sp--;    sp[-1].u.integer -= sp[0].u.integer;    return;       case T_STRING:    {    struct pike_string *s,*ret;    s=make_shared_string("");    ret=string_replace(sp[-2].u.string,sp[-1].u.string,s);    free_string(sp[-2].u.string);
pike.git/src/operators.c:1109:    emit2(F_XOR);    return 1;       default:    return 0;    }   }      void o_lsh(void)   { + #ifdef AUTO_BIGNUM +  if(INT_TYPE_LSH_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer)) +  convert_stack_top_to_bignum(); + #endif /* AUTO_BIGNUM */ +     if(sp[-1].type != T_INT || sp[-2].type != T_INT)    {    int args = 2;    if(call_lfun(LFUN_LSH, LFUN_RLSH))    return;       if(sp[-2].type != T_INT)    SIMPLE_BAD_ARG_ERROR("`<<", 1, "int|object");    SIMPLE_BAD_ARG_ERROR("`<<", 2, "int|object");    }
pike.git/src/operators.c:1154:   {    if(sp[-2].type != T_INT || sp[-1].type != T_INT)    {    int args = 2;    if(call_lfun(LFUN_RSH, LFUN_RRSH))    return;    if(sp[-2].type != T_INT)    SIMPLE_BAD_ARG_ERROR("`>>", 1, "int|object");    SIMPLE_BAD_ARG_ERROR("`>>", 2, "int|object");    } +  + #ifdef AUTO_BIGNUM +  if(INT_TYPE_RSH_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer)) +  {    sp--; -  +  sp[-1].u.integer = 0; +  return; +  } + #endif /* AUTO_BIGNUM */ +  +  sp--;    sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer;   }      void f_rsh(INT32 args)   {    if(args != 2) {    /* FIXME: Not appropriate if too many args. */    SIMPLE_TOO_FEW_ARGS_ERROR("`>>", 2);    }    o_rsh();
pike.git/src/operators.c:1825:    return 1;    }    return 0;   }      void o_negate(void)   {    switch(sp[-1].type)    {    case T_OBJECT: +  do_lfun_negate:    CALL_OPERATOR(LFUN_SUBTRACT,1);    break;       case T_FLOAT:    sp[-1].u.float_number=-sp[-1].u.float_number;    return;       case T_INT: -  + #ifdef AUTO_BIGNUM +  if(INT_TYPE_NEG_OVERFLOW(sp[-1].u.integer)) +  { +  convert_stack_top_to_bignum(); +  goto do_lfun_negate; +  } + #endif /* AUTO_BIGNUM */    sp[-1].u.integer = - sp[-1].u.integer;    return;       default:    PIKE_ERROR("`-", "Bad argument to unary minus.\n", sp, 1);    }   }      void o_range(void)   {