pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1:
/*\ ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License) ||| See the files COPYING and DISCLAIMER for more information. \*/ /**/ #include "global.h" #include <math.h>
-
RCSID("$Id: operators.c,v 1.
65
1999/10/
29
08
:
21
:
50
hubbe
Exp $");
+
RCSID("$Id: operators.c,v 1.
66
1999/10/
30
13
:
18
:
49
noring
Exp $");
#include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h" #include "opcodes.h" #include "operators.h" #include "language.h" #include "pike_memory.h"
pike.git/src/operators.c:1531:
return; } } PIKE_ERROR("`/", "Division on different types.\n", sp, 2); } switch(sp[-2].type) { case T_OBJECT:
+
do_lfun_division:
CALL_OPERATOR(LFUN_DIVIDE,2); break; case T_STRING: { struct array *ret; ret=explode(sp[-2].u.string,sp[-1].u.string); free_string(sp[-2].u.string); free_string(sp[-1].u.string); sp[-2].type=T_ARRAY;
pike.git/src/operators.c:1564:
case T_FLOAT: if(sp[-1].u.float_number == 0.0) OP_DIVISION_BY_ZERO_ERROR("`/"); sp--; sp[-1].u.float_number /= sp[0].u.float_number; return; case T_INT: { INT32 tmp;
+
if (sp[-1].u.integer == 0) OP_DIVISION_BY_ZERO_ERROR("`/");
-
+
+
if(INT_TYPE_DIV_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer))
+
{
+
#ifdef AUTO_BIGNUM
+
stack_swap();
+
convert_stack_top_to_bignum();
+
stack_swap();
+
goto do_lfun_division;
+
#else
+
/* It's not possible to do MININT/-1 (it gives FPU exception on
+
some CPU:s), thus we return what MININT*-1 returns: MININT. */
+
tmp = sp[-2].u.integer;
+
#endif /* AUTO_BIGNUM */
+
}
+
else
+
tmp = sp[-2].u.integer/sp[-1].u.integer;
sp--;
-
tmp=sp[-1].u.integer
/
sp[0].u.integer;
-
+
/
* What is this trying to solve? /Noring */
if((sp[-1].u.integer<0) != (sp[0].u.integer<0)) if(tmp*sp[0].u.integer!=sp[-1].u.integer) tmp--;
-
+
sp[-1].u.integer=tmp; return; } default: PIKE_ERROR("`/", "Bad argument 1.\n", sp, 2); } } void f_divide(INT32 args)