pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.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: operators.c,v 1.219 2007/04/03 17:06:03 grubba Exp $ + || $Id: operators.c,v 1.220 2007/04/26 17:45:44 grubba Exp $   */      #include "global.h"   #include <math.h>   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"   #include "mapping.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/operators.c:923:    goto loop;    case T_OR:    if (low_check_soft_cast(s, type->car)) return 1;    type = type->cdr;    goto loop;    case T_NOT:    return !low_check_soft_cast(s, type->car);    }    if ((s->type == PIKE_T_INT) && !s->u.integer) return 1;    if (s->type == type->type) { -  if (type->type == PIKE_T_INT) return 1; /* FIXME: Check range. */ +  if (type->type == PIKE_T_INT) { +  if (((((INT32)CAR_TO_INT(type)) != MIN_INT32) && +  (s->u.integer < (INT32)CAR_TO_INT(type))) || +  ((((INT32)CDR_TO_INT(type)) != MAX_INT32) && +  (s->u.integer > (INT32)CDR_TO_INT(type)))) { +  return 0; +  } +  return 1; +  }    if (type->type == PIKE_T_FLOAT) return 1; -  if (type->type == PIKE_T_STRING) return 1; +  if (type->type == PIKE_T_STRING) { +  if ((8<<s->u.string->size_shift) > CAR_TO_INT(type)) { +  return 0; +  } +  return 1; +  }    switch(type->type) {    case PIKE_T_OBJECT:    {    struct program *p;    /* Common cases. */    if (!type->cdr) return 1;    if (s->u.object->prog->id == CDR_TO_INT(type)) return 1;    p = id_to_program(CDR_TO_INT(type));    if (!p) return 1;    return implements(s->u.object->prog, p);
pike.git/src/operators.c:5571:    tFunc(tSetvar(0, tStr) tInt,tVar(0)),    tFunc(tSetvar(0, tStr) tFlt,tVar(0))),    OPT_TRY_OPTIMIZE,optimize_binary,generate_multiply);       /* !function(!object...:mixed)&function(mixed...:mixed)|"    "function(int,int...:int)|"    "!function(int...:mixed)&function(float|int...:float)|"    "function(array(0=mixed),array|int|float...:array(array(0)))|"    "function(string,string|int|float...:array(string)) */    ADD_EFUN2("`/", f_divide, -  tOr5(tIfnot(tFuncV(tNone,tNot(tOr(tObj,tMix)),tMix),tFunction), +  tOr5(tIfnot(tFuncV(tNone,tNot(tOr(tObj,tMix)),tMix), +  tFuncV(tNone,tMix,tMix)),    tFuncV(tInt, tInt, tInt),    tIfnot(tFuncV(tNone, tNot(tFlt), tMix),    tFuncV(tOr(tFlt,tInt),tOr(tFlt,tInt),tFlt)),    tFuncV(tArr(tSetvar(0,tMix)),    tOr3(tArray,tInt,tFlt),    tArr(tArr(tVar(0)))),    tFuncV(tStr,tOr3(tStr,tInt,tFlt),tArr(tStr))),    OPT_TRY_OPTIMIZE,0,generate_divide);       /* function(mixed,object:mixed)|"