pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1637:
pop_n_elems(args); push_string(r); break; } case BIT_INT: #ifdef AUTO_BIGNUM size = 0; for(e = -args; e < 0; e++) {
-
if(INT_TYPE_ADD_OVERFLOW(sp[e].u.integer, size))
+
if
(
DO_
INT_TYPE_ADD_OVERFLOW(
size,
sp[e].u.integer,
&
size))
{ convert_svalue_to_bignum(sp-args); f_add(args); return; }
-
else
-
{
-
size += sp[e].u.integer;
+
}
-
}
+
sp-=args; push_int(size); #else size=0; for(e=-args; e<0; e++) size+=sp[e].u.integer; sp-=args-1; sp[-1].u.integer=size; sp[-1].subtype = NUMBER_NUMBER; #endif /* AUTO_BIGNUM */ break;
pike.git/src/operators.c:3597:
case TWO_TYPES(T_INT,T_FLOAT): sp--; sp[-1].u.float_number= (FLOAT_TYPE) sp[-1].u.integer * sp[0].u.float_number; sp[-1].type=T_FLOAT; return; case TWO_TYPES(T_INT,T_INT): #ifdef AUTO_BIGNUM
-
if(INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer))
+
{
-
+
INT_TYPE res;
+
+
if (DO_INT_TYPE_MUL_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer, &res))
+
{
convert_stack_top_to_bignum(); goto do_lfun_multiply; }
-
+
SET_SVAL(sp[-1], T_INT, NUMBER_NUMBER, integer, res);
+
return;
+
}
#endif /* AUTO_BIGNUM */ sp--; sp[-1].u.integer *= sp[0].u.integer; sp[-1].subtype = NUMBER_NUMBER; return; default: do_lfun_multiply: if(call_lfun(LFUN_MULTIPLY, LFUN_RMULTIPLY)) return;
pike.git/src/operators.c:4192:
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
);
} } #ifdef AUTO_BIGNUM if (of) { stack_swap(); convert_stack_top_to_bignum(); stack_swap(); goto do_lfun_modulo; } #endif