Fixed typecheck for std::complex<double>

which was previously broken.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9817 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Gonzalo Garramuno 2007-05-17 11:10:27 +00:00
commit cf0e8cca5a

View file

@ -65,8 +65,8 @@ SWIG_AsVal(Type) (VALUE o, Type* val)
double im = 0; double im = 0;
SWIG_AsVal_double( imag, &im ); SWIG_AsVal_double( imag, &im );
*val = Constructor(re, im); *val = Constructor(re, im);
return SWIG_OK;
} }
return SWIG_OK;
} else { } else {
double d; double d;
int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d)); int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
@ -96,13 +96,14 @@ SWIG_AsVal(Type)(VALUE o, Type *val)
SWIG_AsVal_double( real, &re ); SWIG_AsVal_double( real, &re );
double im = 0; double im = 0;
SWIG_AsVal_double( imag, &im ); SWIG_AsVal_double( imag, &im );
if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) { if ((-FLT_MAX <= re && re <= FLT_MAX) &&
(-FLT_MAX <= im && im <= FLT_MAX)) {
if (val) *val = Constructor(%numeric_cast(re, float), if (val) *val = Constructor(%numeric_cast(re, float),
%numeric_cast(im, float)); %numeric_cast(im, float));
return SWIG_OK; return SWIG_OK;
} else { } else {
return SWIG_OverflowError; return SWIG_OverflowError;
} }
} else { } else {
float re; float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));