summaryrefslogtreecommitdiff
path: root/numpy/core/src/scalarmathmodule.c.src
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-03-09 07:55:54 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-03-09 07:55:54 +0000
commit6a2a979fb3e79a30b4a5020490d855a8d3a44d22 (patch)
tree3a57858e80acc9404c0df56e3c51d267689de9b4 /numpy/core/src/scalarmathmodule.c.src
parente16daf21cc5c64ffc190aa8826f7cb74d49e99be (diff)
downloadnumpy-6a2a979fb3e79a30b4a5020490d855a8d3a44d22.tar.gz
More unsigned comparison warning fixes.
Diffstat (limited to 'numpy/core/src/scalarmathmodule.c.src')
-rw-r--r--numpy/core/src/scalarmathmodule.c.src7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index 6b2fa5b0f..0b4156b14 100644
--- a/numpy/core/src/scalarmathmodule.c.src
+++ b/numpy/core/src/scalarmathmodule.c.src
@@ -965,6 +965,7 @@ static int
* #sign=(signed,unsigned)*5,,,,,,#
* #ctype=long*8,PY_LONG_LONG*2,double*6#
* #realtyp=0*10,1*6#
+ * #unsigntyp=0,1,0,1,0,1,0,1,0,1,1*6#
* #func=(PyLong_FromLong,PyLong_FromUnsignedLong)*4,PyLong_FromLongLong,PyLong_FromUnsignedLongLong,PyLong_FromDouble*6#
*/
static PyObject *
@@ -976,8 +977,14 @@ static PyObject *
modf(x, &ix);
x = ix;
#endif
+
+#if @unsigntyp@
+ if(LONG_MIN < (@ctype@)x && (@ctype@)x < LONG_MAX)
+ return PyInt_FromLong(x);
+#else
if(LONG_MIN < x && x < LONG_MAX)
return PyInt_FromLong(x);
+#endif
return @func@(x);
}
/**end repeat**/