pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:236:    pop_stack();    if(f) return;    }    }    Pike_error("Cast failed, wanted int, got %s\n",    get_name_of_type(TYPEOF(sp[-1])));    }    else if(SUBTYPEOF(sp[-1]) == NUMBER_UNDEFINED)    Pike_error("Cannot cast this object to int.\n");    } -  +     break;       case T_FLOAT: {    FLOAT_TYPE f = sp[-1].u.float_number;       if ( PIKE_ISINF(f) || PIKE_ISNAN(f) )    Pike_error("Can't cast infinites or NaN to int.\n"); -  +  /* should perhaps convert to Int.Inf now that we have them? */       if (UNLIKELY(f > MAX_INT_TYPE || f < MIN_INT_TYPE)) {    convert_stack_top_to_bignum();    } else {    SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, f);    }    break;    }       case T_STRING:
pike.git/src/operators.c:1125:    *! Returns @expr{1@} if the test is successful, @expr{0@}    *! otherwise.    *!    *! @seealso    *! @[`==()]    */      PMOD_EXPORT void f_ne(INT32 args)   {    f_eq(args); -  o_not(); +  /* f_eq and friends always returns 1 or 0. */ +  Pike_sp[-1].u.integer = !Pike_sp[-1].u.integer;   }      /*! @decl int(0..1) `==(mixed arg1, mixed arg2, mixed ... extras)    *!    *! Equality test.    *!    *! Every expression with the @expr{==@} operator becomes a call to    *! this function, i.e. @expr{a==b@} is the same as    *! @expr{predef::`==(a,b)@}.    *!
pike.git/src/operators.c:2214:    {    ref_push_type_value(float_type_string);    stack_swap();    f_cast();    return 1;    }       return 0;   }    - static int call_lfun(int left, int right) + static int call_lfun(enum LFUN left, enum LFUN right)   {    struct object *o;    struct program *p;    int i;       if(TYPEOF(sp[-2]) == T_OBJECT &&    (p = (o = sp[-2].u.object)->prog) &&    (i = FIND_LFUN(p->inherits[SUBTYPEOF(sp[-2])].prog, left)) != -1)    {    apply_low(o, i, 1);
pike.git/src/operators.c:2519:    do_docode(CDR(n),DO_NOT_COPY_TOPLEVEL);    emit0(F_SUBTRACT);    modify_stack_depth(-1);    return 1;    }    return 0;   }      PMOD_EXPORT void o_and(void)   { -  if(TYPEOF(sp[-1]) != TYPEOF(sp[-2])) +  if(UNLIKELY(TYPEOF(sp[-1]) != TYPEOF(sp[-2])))    {    if(call_lfun(LFUN_AND, LFUN_RAND))    return;    else if (((TYPEOF(sp[-1]) == T_TYPE) || (TYPEOF(sp[-1]) == T_PROGRAM) ||    (TYPEOF(sp[-1]) == T_FUNCTION)) &&    ((TYPEOF(sp[-2]) == T_TYPE) || (TYPEOF(sp[-2]) == T_PROGRAM) ||    (TYPEOF(sp[-2]) == T_FUNCTION)))    {    if (TYPEOF(sp[-2]) != T_TYPE)    {