pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1719:
push_string(r); break; } case BIT_INT: { int of = 0; size = 0; for(e = -args; e < 0; e++) {
-
size
=
DO_INT_TYPE_ADD_OVERFLOW(size, sp[e].u.integer, &
of
)
;
-
}
-
if(of
)
+
if
(
DO_INT_TYPE_ADD_OVERFLOW(size, sp[e].u.integer, &
size
))
{ convert_svalue_to_bignum(sp-args); f_add(args); return; }
-
+
}
sp-=args; push_int(size); break; } case BIT_FLOAT: if (args > 2) { /* Attempt to minimize the accumulated summation error * by adding the smallest (absolute) values first. *
pike.git/src/operators.c:3714:
case TWO_TYPES(T_INT,T_FLOAT): sp--; sp[-1].u.float_number= (FLOAT_TYPE) sp[-1].u.integer * sp[0].u.float_number; SET_SVAL_TYPE(sp[-1], T_FLOAT); return; case TWO_TYPES(T_INT,T_INT): { INT_TYPE res;
-
int of = 0;
+
-
res
=
DO_INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer, &
of
)
;
-
-
if(of
)
+
if
(
DO_INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer, &
res
))
{ convert_stack_top_to_bignum(); goto do_lfun_multiply; } sp--; SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, res); return; } default:
pike.git/src/operators.c:4284:
INT_TYPE res; if (b == 0) OP_MODULO_BY_ZERO_ERROR("`%"); if(a>=0) { if(b>=0) { res = a % b; }else{ /* res = ((a+~b)%-b)-~b */
-
res
= DO_INT_TYPE_ADD_OVERFLOW(a, ~b, &
of
)
;
-
res
=
DO_INT_TYPE_MOD_OVERFLOW(res, b, &
of
)
;
-
res
=
DO_INT_TYPE_SUB_OVERFLOW(res, ~b, &
of
);
+
of
= DO_INT_TYPE_ADD_OVERFLOW(a, ~b, &
res
)
+
||
DO_INT_TYPE_MOD_OVERFLOW(res, b, &
res
)
+
||
DO_INT_TYPE_SUB_OVERFLOW(res, ~b, &
res
);
} }else{ if(b>=0) { /* res = b+~((~a) % b) */
-
res
= DO_INT_TYPE_MOD_OVERFLOW(~a, b, &
of
)
;
-
res
=
DO_INT_TYPE_ADD_OVERFLOW(b, ~res, &
of
);
+
of
= DO_INT_TYPE_MOD_OVERFLOW(~a, b, &
res
)
+
||
DO_INT_TYPE_ADD_OVERFLOW(b, ~res, &
res
);
}else{ /* a % b and a % -b are equivalent, if overflow does not * happen * res = -(-a % -b) = a % b; */
-
res
= DO_INT_TYPE_MOD_OVERFLOW(a, b, &
of
);
+
of
= DO_INT_TYPE_MOD_OVERFLOW(a, b, &
res
);
} } if (of) { stack_swap(); convert_stack_top_to_bignum(); stack_swap(); goto do_lfun_modulo; } sp--; SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, res);