Branch: Tag:

2014-08-31

2014-08-31 13:16:09 by Per Hedbor <ph@opera.com>

Do the negative shift check first in <<.

It was somewhat confusing to get bignum errors.

3401:      PMOD_EXPORT void o_lsh(void)   { +  if (sp[-1].u.integer < 0) { +  int args = 2; +  SIMPLE_BAD_ARG_ERROR("`<<", 2, "int(0..)|object"); +  }    if ((TYPEOF(sp[-1]) == T_INT) && (TYPEOF(sp[-2]) == T_INT) &&    INT_TYPE_LSH_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer))    convert_stack_top_to_bignum();
3416:    SIMPLE_BAD_ARG_ERROR("`<<", 2, "int(0..)|object");    }    -  if (sp[-1].u.integer < 0) { -  int args = 2; -  SIMPLE_BAD_ARG_ERROR("`<<", 2, "int(0..)|object"); -  } +     sp--;    SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer,    sp[-1].u.integer << sp->u.integer);