pike.git/
src/
operators.c
Branch:
Tag:
Non-build tags
All tags
No tags
2014-08-31
2014-08-31 13:16:09 by Per Hedbor <ph@opera.com>
37f1a8644928c44a6f1f656f1182232298a47c97 (
9
lines) (+
5
/-
4
)
[
Show
|
Annotate
]
Branch:
8.0
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);