Commit 07d84ea2 authored by Stefan Behnel's avatar Stefan Behnel

fix some C compiler warnings

parent 279efc20
...@@ -473,16 +473,16 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) { ...@@ -473,16 +473,16 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) {
const {{TYPE}} neg_one = ({{TYPE}}) -1, const_zero = 0; const {{TYPE}} neg_one = ({{TYPE}}) -1, const_zero = 0;
const int is_unsigned = neg_one > const_zero; const int is_unsigned = neg_one > const_zero;
if (is_unsigned) { if (is_unsigned) {
if (sizeof({{TYPE}}) < sizeof(unsigned long)) { if (sizeof({{TYPE}}) < sizeof(long)) {
return PyInt_FromLong(value); return PyInt_FromLong((long) value);
} else if (sizeof({{TYPE}}) <= sizeof(unsigned long)) { } else if (sizeof({{TYPE}}) <= sizeof(unsigned long)) {
return PyLong_FromUnsignedLong(value); return PyLong_FromUnsignedLong((unsigned long) value);
} else if (sizeof({{TYPE}}) <= sizeof(unsigned long long)) { } else if (sizeof({{TYPE}}) <= sizeof(unsigned long long)) {
return PyLong_FromUnsignedLongLong(value); return PyLong_FromUnsignedLongLong(value);
} }
} else { } else {
if (sizeof({{TYPE}}) <= sizeof(long)) { if (sizeof({{TYPE}}) <= sizeof(long)) {
return PyInt_FromLong(value); return PyInt_FromLong((long) value);
} else if (sizeof({{TYPE}}) <= sizeof(long long)) { } else if (sizeof({{TYPE}}) <= sizeof(long long)) {
return PyLong_FromLongLong(value); return PyLong_FromLongLong(value);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment