Commit 25ec392a authored by Robert Bradshaw's avatar Robert Bradshaw

Move "longintrepr.h" inclusion before any user includes.

This solves the issue reported by Volker Braun where conflicting
using aliases of uint64_t would result in compile time errors.

Unfortunately, this also means that it's always included if
CYTHON_USE_PYLONG_INTERNALS is set, but it's a short header.
parent e1901d13
......@@ -2,7 +2,7 @@
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
......@@ -33,19 +33,22 @@
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
#define CYTHON_USE_PYLONG_INTERNALS 1
#define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
......
......@@ -467,7 +467,6 @@ bad:
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace); /*proto*/
/////////////// PyNumberPow2 ///////////////
//@requires: TypeConversion.c::PyLongInternals
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace) {
// in CPython, 1<<N is substantially faster than 2**N
......@@ -531,7 +530,6 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, long
#endif
/////////////// PyIntBinop ///////////////
//@requires: TypeConversion.c::PyLongInternals
#if CYTHON_COMPILING_IN_CPYTHON
{{py: from Cython.Utility import pylong_join }}
......@@ -745,7 +743,6 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou
#endif
/////////////// PyFloatBinop ///////////////
//@requires: TypeConversion.c::PyLongInternals
#if CYTHON_COMPILING_IN_CPYTHON
{{py: from Cython.Utility import pylong_join }}
......
......@@ -499,7 +499,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
start = 0;
}
if (stop < 0)
stop += length;
stop += length;
else if (stop > length)
stop = length;
length = stop - start;
......@@ -735,7 +735,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value
static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyObject* value);
//////////////////// ByteArrayAppendObject ////////////////////
//@requires: TypeConversion.c::PyLongInternals
//@requires: ByteArrayAppend
static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyObject* value) {
......
......@@ -175,7 +175,6 @@ bad:
#endif
/////////////// TypeConversions ///////////////
//@requires: PyLongInternals
/* Type Conversion Functions */
......@@ -589,20 +588,12 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) {
}
/////////////// PyLongInternals ///////////////
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
/////////////// CIntFromPy.proto ///////////////
static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *);
/////////////// CIntFromPy ///////////////
//@requires: CIntFromPyVerify
//@requires: PyLongInternals
{{py: from Cython.Utility import pylong_join }}
......
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