pike.git/
src/
operators.c
Branch:
Tag:
Non-build tags
All tags
No tags
2016-05-18
2016-05-18 14:50:22 by Per Hedbor <ph@opera.com>
5f6ffce03add45c30a418819499903a102aaa6ce (
21
lines) (+
19
/-
2
)
[
Show
|
Annotate
]
Branch:
8.1
More correct handling of various cases for **
3789:
/* fallthrough again (this is the slow path).. */ case TWO_TYPES(T_OBJECT,T_INT):
+
case TWO_TYPES(T_OBJECT,T_FLOAT):
case TWO_TYPES(T_OBJECT,T_OBJECT):
-
+
case TWO_TYPES(T_INT,T_OBJECT):
+
case TWO_TYPES(T_FLOAT,T_OBJECT):
if( !call_lfun( LFUN_POW, LFUN_RPOW ) )
-
Pike
_
error
(
"Illegal
argument
1
to
`**.\n"
);
+
{
+
if( TYPEOF(sp[-2]) != PIKE
_
T_OBJECT )
+
{
+
stack_swap
(
);
+
convert_stack_top_
to
_bignum();
+
stack_swap(
);
+
if( call_lfun( LFUN_POW, LFUN_RPOW ) )
return; }
-
+
Pike_error("Illegal argument 1 to `** (object missing implementation of `**).\n");
}
-
+
return;
+
}
+
}
/*! @decl mixed `*(mixed arg1)
5929:
"function(string,float:string) */ ADD_EFUN2("`**", f_exponent,
-
tOr4
(tFunc(tInt tInt,tInt),
+
tOr7
(tFunc(tInt tInt,tInt),
tFunc(tFloat tFloat, tFloat),
-
+
tFunc(tOr(tInt,tFloat) tObj, tOr3(tFloat,tInt,tFloat)),
tFunc(tInt tFloat, tFloat),
-
+
tFunc(tObj tMix, tOr3(tFloat,tInt,tObj)),
+
tFunc(tMix tObj, tOr3(tFloat,tInt,tObj)),
tFunc(tFloat tInt, tFloat)), OPT_TRY_OPTIMIZE,0,0);