castmode was failing overflow tests. Fix it.
This commit is contained in:
parent
23caea3b68
commit
7dc5879714
1 changed files with 4 additions and 0 deletions
|
|
@ -223,6 +223,8 @@ SWIG_AsVal_dec(long long)(PyObject *obj, long long *val)
|
|||
const double mant_min = -mant_max;
|
||||
double d;
|
||||
res = SWIG_AsVal(double)(obj,&d);
|
||||
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max))
|
||||
return SWIG_OverflowError;
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) {
|
||||
if (val) *val = (long long)(d);
|
||||
return SWIG_AddCast(res);
|
||||
|
|
@ -280,6 +282,8 @@ SWIG_AsVal_dec(unsigned long long)(PyObject *obj, unsigned long long *val)
|
|||
const double mant_max = 1LL << DBL_MANT_DIG;
|
||||
double d;
|
||||
res = SWIG_AsVal(double)(obj,&d);
|
||||
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
|
||||
return SWIG_OverflowError;
|
||||
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
|
||||
if (val) *val = (unsigned long long)(d);
|
||||
return SWIG_AddCast(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue