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.131 2001/03/17 17:39:08 grubba Exp $"); + RCSID("$Id: operators.c,v 1.132 2001/03/18 16:10:10 grubba 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:1839:    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");    } + #ifndef AUTO_BIGNUM +  if (sp[-1].u.integer > 31) {    sp--; -  +  sp[-1].u.integer = 0; +  return; +  } + #endif /* !AUTO_BIGNUM */ +  sp--;    sp[-1].u.integer = sp[-1].u.integer << sp->u.integer;   }      /*! @decl int `<<(int arg1, int arg2)    *! @decl mixed `<<(object arg1, int|object arg2)    *! @decl mixed `<<(int arg1, object arg2)    *!    *! Left shift operator.    *!    *! If @[arg1] is an object that implements @[lfun::`<<()], that
pike.git/src/operators.c:1899:    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;    } + #else /* !AUTO_BIGNUM */ +  if (sp[-1].u.integer > 31) { +  sp--; +  if (sp[-1].u.integer < 0) { +  sp[-1].u.integer = -1; +  } else { +  sp[-1].u.integer = 0; +  } +  return; +  }   #endif /* AUTO_BIGNUM */       sp--;    sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer;   }      /*! @decl int `>>(int arg1, int arg2)    *! @decl mixed `>>(object arg1, int|object arg2)    *! @decl mixed `>>(int arg1, object arg2)    *!