require a long long data type (closes #27961)
This commit is contained in:
parent
b3b0767861
commit
ed4aa83ff7
|
@ -524,11 +524,6 @@ APIs:
|
||||||
An unrecognized format character causes all the rest of the format string to be
|
An unrecognized format character causes all the rest of the format string to be
|
||||||
copied as-is to the result string, and any extra arguments discarded.
|
copied as-is to the result string, and any extra arguments discarded.
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The `"%lld"` and `"%llu"` format specifiers are only available
|
|
||||||
when :const:`HAVE_LONG_LONG` is defined.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
The width formatter unit is number of characters rather than bytes.
|
The width formatter unit is number of characters rather than bytes.
|
||||||
The precision formatter unit is number of bytes for ``"%s"`` and
|
The precision formatter unit is number of bytes for ``"%s"`` and
|
||||||
|
|
|
@ -85,14 +85,12 @@ PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
|
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
|
||||||
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
|
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
|
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
|
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
|
||||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
|
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
|
||||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
|
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
|
||||||
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
|
||||||
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
|
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
|
|
|
@ -35,10 +35,6 @@ HAVE_UINTPTR_T
|
||||||
Meaning: The C9X type uintptr_t is supported by the compiler
|
Meaning: The C9X type uintptr_t is supported by the compiler
|
||||||
Used in: Py_uintptr_t
|
Used in: Py_uintptr_t
|
||||||
|
|
||||||
HAVE_LONG_LONG
|
|
||||||
Meaning: The compiler supports the C type "long long"
|
|
||||||
Used in: PY_LONG_LONG
|
|
||||||
|
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/* typedefs for some C9X-defined synonyms for integral types.
|
/* typedefs for some C9X-defined synonyms for integral types.
|
||||||
|
@ -53,7 +49,6 @@ Used in: PY_LONG_LONG
|
||||||
* integral synonyms. Only define the ones we actually need.
|
* integral synonyms. Only define the ones we actually need.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
#ifndef PY_LONG_LONG
|
#ifndef PY_LONG_LONG
|
||||||
#define PY_LONG_LONG long long
|
#define PY_LONG_LONG long long
|
||||||
#if defined(LLONG_MAX)
|
#if defined(LLONG_MAX)
|
||||||
|
@ -78,7 +73,6 @@ Used in: PY_LONG_LONG
|
||||||
#define PY_ULLONG_MAX (PY_LLONG_MAX * Py_ULL(2) + 1)
|
#define PY_ULLONG_MAX (PY_LLONG_MAX * Py_ULL(2) + 1)
|
||||||
#endif /* LLONG_MAX */
|
#endif /* LLONG_MAX */
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
/* a build with 30-bit digits for Python integers needs an exact-width
|
/* a build with 30-bit digits for Python integers needs an exact-width
|
||||||
* 32-bit unsigned integer type to store those digits. (We could just use
|
* 32-bit unsigned integer type to store those digits. (We could just use
|
||||||
|
@ -161,7 +155,7 @@ typedef int Py_intptr_t;
|
||||||
typedef unsigned long Py_uintptr_t;
|
typedef unsigned long Py_uintptr_t;
|
||||||
typedef long Py_intptr_t;
|
typedef long Py_intptr_t;
|
||||||
|
|
||||||
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
|
#elif SIZEOF_VOID_P <= SIZEOF_LONG_LONG
|
||||||
typedef unsigned PY_LONG_LONG Py_uintptr_t;
|
typedef unsigned PY_LONG_LONG Py_uintptr_t;
|
||||||
typedef PY_LONG_LONG Py_intptr_t;
|
typedef PY_LONG_LONG Py_intptr_t;
|
||||||
|
|
||||||
|
@ -248,19 +242,16 @@ typedef int Py_ssize_clean_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for
|
/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for
|
||||||
* the long long type instead of the size_t type. It's only available
|
* the long long type instead of the size_t type. The "high level" Python format
|
||||||
* when HAVE_LONG_LONG is defined. The "high level" Python format
|
|
||||||
* functions listed above will interpret "lld" or "llu" correctly on
|
* functions listed above will interpret "lld" or "llu" correctly on
|
||||||
* all platforms.
|
* all platforms.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifndef PY_FORMAT_LONG_LONG
|
||||||
# ifndef PY_FORMAT_LONG_LONG
|
# ifdef MS_WINDOWS
|
||||||
# ifdef MS_WINDOWS
|
# define PY_FORMAT_LONG_LONG "I64"
|
||||||
# define PY_FORMAT_LONG_LONG "I64"
|
# else
|
||||||
# else
|
# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
|
||||||
# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
|
# endif
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Py_LOCAL can be used instead of static to get the fastest possible calling
|
/* Py_LOCAL can be used instead of static to get the fastest possible calling
|
||||||
|
|
|
@ -37,13 +37,8 @@ PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int);
|
||||||
module exposes a higher-level API, with timeouts expressed in seconds
|
module exposes a higher-level API, with timeouts expressed in seconds
|
||||||
and floating-point numbers allowed.
|
and floating-point numbers allowed.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_LONG_LONG)
|
|
||||||
#define PY_TIMEOUT_T PY_LONG_LONG
|
#define PY_TIMEOUT_T PY_LONG_LONG
|
||||||
#define PY_TIMEOUT_MAX PY_LLONG_MAX
|
#define PY_TIMEOUT_MAX PY_LLONG_MAX
|
||||||
#else
|
|
||||||
#define PY_TIMEOUT_T long
|
|
||||||
#define PY_TIMEOUT_MAX LONG_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* In the NT API, the timeout is a DWORD and is expressed in milliseconds */
|
/* In the NT API, the timeout is a DWORD and is expressed in milliseconds */
|
||||||
#if defined (NT_THREADS)
|
#if defined (NT_THREADS)
|
||||||
|
|
|
@ -49,10 +49,8 @@ typedef struct PyMemberDef {
|
||||||
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
|
#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError
|
||||||
when the value is NULL, instead of
|
when the value is NULL, instead of
|
||||||
converting to None. */
|
converting to None. */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
#define T_LONGLONG 17
|
#define T_LONGLONG 17
|
||||||
#define T_ULONGLONG 18
|
#define T_ULONGLONG 18
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
#define T_PYSSIZET 19 /* Py_ssize_t */
|
#define T_PYSSIZET 19 /* Py_ssize_t */
|
||||||
#define T_NONE 20 /* Value is always None */
|
#define T_NONE 20 /* Value is always None */
|
||||||
|
|
|
@ -16,22 +16,10 @@ byteorders = '', '@', '=', '<', '>', '!'
|
||||||
def iter_integer_formats(byteorders=byteorders):
|
def iter_integer_formats(byteorders=byteorders):
|
||||||
for code in integer_codes:
|
for code in integer_codes:
|
||||||
for byteorder in byteorders:
|
for byteorder in byteorders:
|
||||||
if (byteorder in ('', '@') and code in ('q', 'Q') and
|
|
||||||
not HAVE_LONG_LONG):
|
|
||||||
continue
|
|
||||||
if (byteorder not in ('', '@') and code in ('n', 'N')):
|
if (byteorder not in ('', '@') and code in ('n', 'N')):
|
||||||
continue
|
continue
|
||||||
yield code, byteorder
|
yield code, byteorder
|
||||||
|
|
||||||
# Native 'q' packing isn't available on systems that don't have the C
|
|
||||||
# long long type.
|
|
||||||
try:
|
|
||||||
struct.pack('q', 5)
|
|
||||||
except struct.error:
|
|
||||||
HAVE_LONG_LONG = False
|
|
||||||
else:
|
|
||||||
HAVE_LONG_LONG = True
|
|
||||||
|
|
||||||
def string_reverse(s):
|
def string_reverse(s):
|
||||||
return s[::-1]
|
return s[::-1]
|
||||||
|
|
||||||
|
@ -159,9 +147,7 @@ class StructTest(unittest.TestCase):
|
||||||
self.assertEqual(size, expected_size[code])
|
self.assertEqual(size, expected_size[code])
|
||||||
|
|
||||||
# native integer sizes
|
# native integer sizes
|
||||||
native_pairs = 'bB', 'hH', 'iI', 'lL', 'nN'
|
native_pairs = 'bB', 'hH', 'iI', 'lL', 'nN', 'qQ'
|
||||||
if HAVE_LONG_LONG:
|
|
||||||
native_pairs += 'qQ',
|
|
||||||
for format_pair in native_pairs:
|
for format_pair in native_pairs:
|
||||||
for byteorder in '', '@':
|
for byteorder in '', '@':
|
||||||
signed_size = struct.calcsize(byteorder + format_pair[0])
|
signed_size = struct.calcsize(byteorder + format_pair[0])
|
||||||
|
@ -174,9 +160,8 @@ class StructTest(unittest.TestCase):
|
||||||
self.assertLessEqual(4, struct.calcsize('l'))
|
self.assertLessEqual(4, struct.calcsize('l'))
|
||||||
self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i'))
|
self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i'))
|
||||||
self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l'))
|
self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l'))
|
||||||
if HAVE_LONG_LONG:
|
self.assertLessEqual(8, struct.calcsize('q'))
|
||||||
self.assertLessEqual(8, struct.calcsize('q'))
|
self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q'))
|
||||||
self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q'))
|
|
||||||
self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('i'))
|
self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('i'))
|
||||||
self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('P'))
|
self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('P'))
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #27961?: Require platforms to support ``long long``. Python hasn't
|
||||||
|
compiled without ``long long`` for years, so this is basically a formality.
|
||||||
|
|
||||||
- Issue #27355: Removed support for Windows CE. It was never finished,
|
- Issue #27355: Removed support for Windows CE. It was never finished,
|
||||||
and Windows CE is no longer a relevant platform for Python.
|
and Windows CE is no longer a relevant platform for Python.
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,6 @@ EXPORT(int) _testfunc_callback_with_pointer(int (*func)(int *))
|
||||||
return (*func)(table);
|
return (*func)(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
EXPORT(PY_LONG_LONG) _testfunc_q_bhilfdq(signed char b, short h, int i, long l, float f,
|
EXPORT(PY_LONG_LONG) _testfunc_q_bhilfdq(signed char b, short h, int i, long l, float f,
|
||||||
double d, PY_LONG_LONG q)
|
double d, PY_LONG_LONG q)
|
||||||
{
|
{
|
||||||
|
@ -267,8 +266,6 @@ EXPORT(PY_LONG_LONG) _testfunc_callback_q_qf(PY_LONG_LONG value,
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
|
@ -474,7 +474,6 @@ PyCArg_repr(PyCArgObject *self)
|
||||||
self->tag, self->value.l);
|
self->tag, self->value.l);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q':
|
case 'q':
|
||||||
case 'Q':
|
case 'Q':
|
||||||
sprintf(buffer,
|
sprintf(buffer,
|
||||||
|
@ -485,7 +484,6 @@ PyCArg_repr(PyCArgObject *self)
|
||||||
#endif
|
#endif
|
||||||
self->tag, self->value.q);
|
self->tag, self->value.q);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case 'd':
|
case 'd':
|
||||||
sprintf(buffer, "<cparam '%c' (%f)>",
|
sprintf(buffer, "<cparam '%c' (%f)>",
|
||||||
self->tag, self->value.d);
|
self->tag, self->value.d);
|
||||||
|
@ -593,9 +591,7 @@ union result {
|
||||||
short h;
|
short h;
|
||||||
int i;
|
int i;
|
||||||
long l;
|
long l;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG q;
|
PY_LONG_LONG q;
|
||||||
#endif
|
|
||||||
long double D;
|
long double D;
|
||||||
double d;
|
double d;
|
||||||
float f;
|
float f;
|
||||||
|
|
|
@ -379,8 +379,6 @@ get_ulong(PyObject *v, unsigned long *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
/* Same, but handling native long long. */
|
/* Same, but handling native long long. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -417,8 +415,6 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* Integer fields, with bitfield support
|
* Integer fields, with bitfield support
|
||||||
*/
|
*/
|
||||||
|
@ -888,7 +884,6 @@ L_get_sw(void *ptr, Py_ssize_t size)
|
||||||
return PyLong_FromUnsignedLong(val);
|
return PyLong_FromUnsignedLong(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
q_set(void *ptr, PyObject *value, Py_ssize_t size)
|
q_set(void *ptr, PyObject *value, Py_ssize_t size)
|
||||||
{
|
{
|
||||||
|
@ -982,7 +977,6 @@ Q_get_sw(void *ptr, Py_ssize_t size)
|
||||||
GET_BITFIELD(val, size);
|
GET_BITFIELD(val, size);
|
||||||
return PyLong_FromUnsignedLongLong(val);
|
return PyLong_FromUnsignedLongLong(val);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* non-integer accessor methods, not supporting bit fields
|
* non-integer accessor methods, not supporting bit fields
|
||||||
|
@ -1490,9 +1484,7 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size)
|
||||||
#if SIZEOF_VOID_P <= SIZEOF_LONG
|
#if SIZEOF_VOID_P <= SIZEOF_LONG
|
||||||
v = (void *)PyLong_AsUnsignedLongMask(value);
|
v = (void *)PyLong_AsUnsignedLongMask(value);
|
||||||
#else
|
#else
|
||||||
#ifndef HAVE_LONG_LONG
|
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
||||||
# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long"
|
|
||||||
#elif SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
|
||||||
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
||||||
#endif
|
#endif
|
||||||
v = (void *)PyLong_AsUnsignedLongLongMask(value);
|
v = (void *)PyLong_AsUnsignedLongLongMask(value);
|
||||||
|
@ -1538,13 +1530,11 @@ static struct fielddesc formattable[] = {
|
||||||
#else
|
#else
|
||||||
# error
|
# error
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
#if SIZEOF_LONG_LONG == 8
|
#if SIZEOF_LONG_LONG == 8
|
||||||
{ 'q', q_set, q_get, &ffi_type_sint64, q_set_sw, q_get_sw},
|
{ 'q', q_set, q_get, &ffi_type_sint64, q_set_sw, q_get_sw},
|
||||||
{ 'Q', Q_set, Q_get, &ffi_type_uint64, Q_set_sw, Q_get_sw},
|
{ 'Q', Q_set, Q_get, &ffi_type_uint64, Q_set_sw, Q_get_sw},
|
||||||
#else
|
#else
|
||||||
# error
|
# error
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
{ 'P', P_set, P_get, &ffi_type_pointer},
|
{ 'P', P_set, P_get, &ffi_type_pointer},
|
||||||
{ 'z', z_set, z_get, &ffi_type_pointer},
|
{ 'z', z_set, z_get, &ffi_type_pointer},
|
||||||
|
@ -1635,10 +1625,8 @@ typedef struct { char c; wchar_t *x; } s_wchar_p;
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
typedef struct { char c; PY_LONG_LONG x; } s_long_long;
|
typedef struct { char c; PY_LONG_LONG x; } s_long_long;
|
||||||
#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG))
|
#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG))
|
||||||
#endif
|
|
||||||
|
|
||||||
/* from ffi.h:
|
/* from ffi.h:
|
||||||
typedef struct _ffi_type
|
typedef struct _ffi_type
|
||||||
|
|
|
@ -31,9 +31,7 @@ union value {
|
||||||
long l;
|
long l;
|
||||||
float f;
|
float f;
|
||||||
double d;
|
double d;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG ll;
|
PY_LONG_LONG ll;
|
||||||
#endif
|
|
||||||
long double D;
|
long double D;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -303,9 +301,7 @@ struct tagPyCArgObject {
|
||||||
short h;
|
short h;
|
||||||
int i;
|
int i;
|
||||||
long l;
|
long l;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG q;
|
PY_LONG_LONG q;
|
||||||
#endif
|
|
||||||
long double D;
|
long double D;
|
||||||
double d;
|
double d;
|
||||||
float f;
|
float f;
|
||||||
|
|
|
@ -104,7 +104,7 @@ typedef off_t Py_off_t;
|
||||||
# define PY_OFF_T_MIN PY_SSIZE_T_MIN
|
# define PY_OFF_T_MIN PY_SSIZE_T_MIN
|
||||||
# define PY_OFF_T_COMPAT Py_ssize_t
|
# define PY_OFF_T_COMPAT Py_ssize_t
|
||||||
# define PY_PRIdOFF "zd"
|
# define PY_PRIdOFF "zd"
|
||||||
#elif (HAVE_LONG_LONG && SIZEOF_OFF_T == SIZEOF_LONG_LONG)
|
#elif (SIZEOF_OFF_T == SIZEOF_LONG_LONG)
|
||||||
# define PyLong_AsOff_t PyLong_AsLongLong
|
# define PyLong_AsOff_t PyLong_AsLongLong
|
||||||
# define PyLong_FromOff_t PyLong_FromLongLong
|
# define PyLong_FromOff_t PyLong_FromLongLong
|
||||||
# define PY_OFF_T_MAX PY_LLONG_MAX
|
# define PY_OFF_T_MAX PY_LLONG_MAX
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
#include "frameobject.h"
|
#include "frameobject.h"
|
||||||
#include "rotatingtree.h"
|
#include "rotatingtree.h"
|
||||||
|
|
||||||
#if !defined(HAVE_LONG_LONG)
|
|
||||||
#error "This module requires long longs!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*** Selection of a high-precision timer ***/
|
/*** Selection of a high-precision timer ***/
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#if SIZEOF_VOID_P == SIZEOF_LONG
|
#if SIZEOF_VOID_P == SIZEOF_LONG
|
||||||
# define F_POINTER "k"
|
# define F_POINTER "k"
|
||||||
# define T_POINTER T_ULONG
|
# define T_POINTER T_ULONG
|
||||||
#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG)
|
#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
||||||
# define F_POINTER "K"
|
# define F_POINTER "K"
|
||||||
# define T_POINTER T_ULONGLONG
|
# define T_POINTER T_ULONGLONG
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -113,7 +113,6 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st)
|
||||||
PyObject *
|
PyObject *
|
||||||
_pysqlite_long_from_int64(sqlite_int64 value)
|
_pysqlite_long_from_int64(sqlite_int64 value)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
# if SIZEOF_LONG_LONG < 8
|
# if SIZEOF_LONG_LONG < 8
|
||||||
if (value > PY_LLONG_MAX || value < PY_LLONG_MIN) {
|
if (value > PY_LLONG_MAX || value < PY_LLONG_MIN) {
|
||||||
return _PyLong_FromByteArray(&value, sizeof(value),
|
return _PyLong_FromByteArray(&value, sizeof(value),
|
||||||
|
@ -124,14 +123,6 @@ _pysqlite_long_from_int64(sqlite_int64 value)
|
||||||
if (value > LONG_MAX || value < LONG_MIN)
|
if (value > LONG_MAX || value < LONG_MIN)
|
||||||
return PyLong_FromLongLong(value);
|
return PyLong_FromLongLong(value);
|
||||||
# endif
|
# endif
|
||||||
#else
|
|
||||||
# if SIZEOF_LONG < 8
|
|
||||||
if (value > LONG_MAX || value < LONG_MIN) {
|
|
||||||
return _PyLong_FromByteArray(&value, sizeof(value),
|
|
||||||
IS_LITTLE_ENDIAN, 1 /* signed */);
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(value, sqlite_int64, long));
|
return PyLong_FromLong(Py_SAFE_DOWNCAST(value, sqlite_int64, long));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,23 +130,13 @@ sqlite_int64
|
||||||
_pysqlite_long_as_int64(PyObject * py_val)
|
_pysqlite_long_as_int64(PyObject * py_val)
|
||||||
{
|
{
|
||||||
int overflow;
|
int overflow;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG value = PyLong_AsLongLongAndOverflow(py_val, &overflow);
|
PY_LONG_LONG value = PyLong_AsLongLongAndOverflow(py_val, &overflow);
|
||||||
#else
|
|
||||||
long value = PyLong_AsLongAndOverflow(py_val, &overflow);
|
|
||||||
#endif
|
|
||||||
if (value == -1 && PyErr_Occurred())
|
if (value == -1 && PyErr_Occurred())
|
||||||
return -1;
|
return -1;
|
||||||
if (!overflow) {
|
if (!overflow) {
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
# if SIZEOF_LONG_LONG > 8
|
# if SIZEOF_LONG_LONG > 8
|
||||||
if (-0x8000000000000000LL <= value && value <= 0x7FFFFFFFFFFFFFFFLL)
|
if (-0x8000000000000000LL <= value && value <= 0x7FFFFFFFFFFFFFFFLL)
|
||||||
# endif
|
# endif
|
||||||
#else
|
|
||||||
# if SIZEOF_LONG > 8
|
|
||||||
if (-0x8000000000000000L <= value && value <= 0x7FFFFFFFFFFFFFFFL)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
else if (sizeof(value) < sizeof(sqlite_int64)) {
|
else if (sizeof(value) < sizeof(sqlite_int64)) {
|
||||||
|
|
|
@ -71,10 +71,8 @@ typedef struct { char c; size_t x; } st_size_t;
|
||||||
|
|
||||||
/* We can't support q and Q in native mode unless the compiler does;
|
/* We can't support q and Q in native mode unless the compiler does;
|
||||||
in std mode, they're 8 bytes on all platforms. */
|
in std mode, they're 8 bytes on all platforms. */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
typedef struct { char c; PY_LONG_LONG x; } s_long_long;
|
typedef struct { char c; PY_LONG_LONG x; } s_long_long;
|
||||||
#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG))
|
#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG))
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_C99_BOOL
|
#ifdef HAVE_C99_BOOL
|
||||||
#define BOOL_TYPE _Bool
|
#define BOOL_TYPE _Bool
|
||||||
|
@ -164,8 +162,6 @@ get_ulong(PyObject *v, unsigned long *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
/* Same, but handling native long long. */
|
/* Same, but handling native long long. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -212,8 +208,6 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Same, but handling Py_ssize_t */
|
/* Same, but handling Py_ssize_t */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -463,8 +457,6 @@ nu_size_t(const char *p, const formatdef *f)
|
||||||
/* Native mode doesn't support q or Q unless the platform C supports
|
/* Native mode doesn't support q or Q unless the platform C supports
|
||||||
long long (or, on Windows, __int64). */
|
long long (or, on Windows, __int64). */
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
nu_longlong(const char *p, const formatdef *f)
|
nu_longlong(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
|
@ -485,8 +477,6 @@ nu_ulonglong(const char *p, const formatdef *f)
|
||||||
return PyLong_FromUnsignedLongLong(x);
|
return PyLong_FromUnsignedLongLong(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
nu_bool(const char *p, const formatdef *f)
|
nu_bool(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
|
@ -680,8 +670,6 @@ np_size_t(char *p, PyObject *v, const formatdef *f)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
np_longlong(char *p, PyObject *v, const formatdef *f)
|
np_longlong(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
|
@ -701,7 +689,6 @@ np_ulonglong(char *p, PyObject *v, const formatdef *f)
|
||||||
memcpy(p, (char *)&x, sizeof x);
|
memcpy(p, (char *)&x, sizeof x);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -785,10 +772,8 @@ static const formatdef native_table[] = {
|
||||||
{'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong},
|
{'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong},
|
||||||
{'n', sizeof(size_t), SIZE_T_ALIGN, nu_ssize_t, np_ssize_t},
|
{'n', sizeof(size_t), SIZE_T_ALIGN, nu_ssize_t, np_ssize_t},
|
||||||
{'N', sizeof(size_t), SIZE_T_ALIGN, nu_size_t, np_size_t},
|
{'N', sizeof(size_t), SIZE_T_ALIGN, nu_size_t, np_size_t},
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
{'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong},
|
{'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong},
|
||||||
{'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong},
|
{'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong},
|
||||||
#endif
|
|
||||||
{'?', sizeof(BOOL_TYPE), BOOL_ALIGN, nu_bool, np_bool},
|
{'?', sizeof(BOOL_TYPE), BOOL_ALIGN, nu_bool, np_bool},
|
||||||
{'e', sizeof(short), SHORT_ALIGN, nu_halffloat, np_halffloat},
|
{'e', sizeof(short), SHORT_ALIGN, nu_halffloat, np_halffloat},
|
||||||
{'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float},
|
{'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float},
|
||||||
|
@ -831,7 +816,6 @@ bu_uint(const char *p, const formatdef *f)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bu_longlong(const char *p, const formatdef *f)
|
bu_longlong(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG x = 0;
|
PY_LONG_LONG x = 0;
|
||||||
Py_ssize_t i = f->size;
|
Py_ssize_t i = f->size;
|
||||||
const unsigned char *bytes = (const unsigned char *)p;
|
const unsigned char *bytes = (const unsigned char *)p;
|
||||||
|
@ -844,18 +828,11 @@ bu_longlong(const char *p, const formatdef *f)
|
||||||
if (x >= LONG_MIN && x <= LONG_MAX)
|
if (x >= LONG_MIN && x <= LONG_MAX)
|
||||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||||
return PyLong_FromLongLong(x);
|
return PyLong_FromLongLong(x);
|
||||||
#else
|
|
||||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
|
||||||
8,
|
|
||||||
0, /* little-endian */
|
|
||||||
1 /* signed */);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bu_ulonglong(const char *p, const formatdef *f)
|
bu_ulonglong(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
unsigned PY_LONG_LONG x = 0;
|
unsigned PY_LONG_LONG x = 0;
|
||||||
Py_ssize_t i = f->size;
|
Py_ssize_t i = f->size;
|
||||||
const unsigned char *bytes = (const unsigned char *)p;
|
const unsigned char *bytes = (const unsigned char *)p;
|
||||||
|
@ -865,12 +842,6 @@ bu_ulonglong(const char *p, const formatdef *f)
|
||||||
if (x <= LONG_MAX)
|
if (x <= LONG_MAX)
|
||||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||||
return PyLong_FromUnsignedLongLong(x);
|
return PyLong_FromUnsignedLongLong(x);
|
||||||
#else
|
|
||||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
|
||||||
8,
|
|
||||||
0, /* little-endian */
|
|
||||||
0 /* signed */);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1072,7 +1043,6 @@ lu_uint(const char *p, const formatdef *f)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
lu_longlong(const char *p, const formatdef *f)
|
lu_longlong(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG x = 0;
|
PY_LONG_LONG x = 0;
|
||||||
Py_ssize_t i = f->size;
|
Py_ssize_t i = f->size;
|
||||||
const unsigned char *bytes = (const unsigned char *)p;
|
const unsigned char *bytes = (const unsigned char *)p;
|
||||||
|
@ -1085,18 +1055,11 @@ lu_longlong(const char *p, const formatdef *f)
|
||||||
if (x >= LONG_MIN && x <= LONG_MAX)
|
if (x >= LONG_MIN && x <= LONG_MAX)
|
||||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||||
return PyLong_FromLongLong(x);
|
return PyLong_FromLongLong(x);
|
||||||
#else
|
|
||||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
|
||||||
8,
|
|
||||||
1, /* little-endian */
|
|
||||||
1 /* signed */);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
lu_ulonglong(const char *p, const formatdef *f)
|
lu_ulonglong(const char *p, const formatdef *f)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
unsigned PY_LONG_LONG x = 0;
|
unsigned PY_LONG_LONG x = 0;
|
||||||
Py_ssize_t i = f->size;
|
Py_ssize_t i = f->size;
|
||||||
const unsigned char *bytes = (const unsigned char *)p;
|
const unsigned char *bytes = (const unsigned char *)p;
|
||||||
|
@ -1106,12 +1069,6 @@ lu_ulonglong(const char *p, const formatdef *f)
|
||||||
if (x <= LONG_MAX)
|
if (x <= LONG_MAX)
|
||||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||||
return PyLong_FromUnsignedLongLong(x);
|
return PyLong_FromUnsignedLongLong(x);
|
||||||
#else
|
|
||||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
|
||||||
8,
|
|
||||||
1, /* little-endian */
|
|
||||||
0 /* signed */);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -60,9 +60,7 @@ test_config(PyObject *self)
|
||||||
CHECK_SIZEOF(SIZEOF_LONG, long);
|
CHECK_SIZEOF(SIZEOF_LONG, long);
|
||||||
CHECK_SIZEOF(SIZEOF_VOID_P, void*);
|
CHECK_SIZEOF(SIZEOF_VOID_P, void*);
|
||||||
CHECK_SIZEOF(SIZEOF_TIME_T, time_t);
|
CHECK_SIZEOF(SIZEOF_TIME_T, time_t);
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG);
|
CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG);
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef CHECK_SIZEOF
|
#undef CHECK_SIZEOF
|
||||||
|
|
||||||
|
@ -357,7 +355,7 @@ test_lazy_hash_inheritance(PyObject* self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Tests of PyLong_{As, From}{Unsigned,}Long(), and (#ifdef HAVE_LONG_LONG)
|
/* Tests of PyLong_{As, From}{Unsigned,}Long(), and
|
||||||
PyLong_{As, From}{Unsigned,}LongLong().
|
PyLong_{As, From}{Unsigned,}LongLong().
|
||||||
|
|
||||||
Note that the meat of the test is contained in testcapi_long.h.
|
Note that the meat of the test is contained in testcapi_long.h.
|
||||||
|
@ -402,8 +400,6 @@ test_long_api(PyObject* self)
|
||||||
#undef F_U_TO_PY
|
#undef F_U_TO_PY
|
||||||
#undef F_PY_TO_U
|
#undef F_PY_TO_U
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
raise_test_longlong_error(const char* msg)
|
raise_test_longlong_error(const char* msg)
|
||||||
{
|
{
|
||||||
|
@ -870,8 +866,6 @@ test_L_code(PyObject *self)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ifdef HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
return_none(void *unused)
|
return_none(void *unused)
|
||||||
{
|
{
|
||||||
|
@ -1136,7 +1130,6 @@ getargs_p(PyObject *self, PyObject *args)
|
||||||
return PyLong_FromLong(value);
|
return PyLong_FromLong(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
getargs_L(PyObject *self, PyObject *args)
|
getargs_L(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -1154,7 +1147,6 @@ getargs_K(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
return PyLong_FromUnsignedLongLong(value);
|
return PyLong_FromUnsignedLongLong(value);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This function not only tests the 'k' getargs code, but also the
|
/* This function not only tests the 'k' getargs code, but also the
|
||||||
PyLong_AsUnsignedLongMask() and PyLong_AsUnsignedLongMask() functions. */
|
PyLong_AsUnsignedLongMask() and PyLong_AsUnsignedLongMask() functions. */
|
||||||
|
@ -2279,10 +2271,8 @@ test_string_from_format(PyObject *self, PyObject *args)
|
||||||
CHECK_1_FORMAT("%zu", size_t);
|
CHECK_1_FORMAT("%zu", size_t);
|
||||||
|
|
||||||
/* "%lld" and "%llu" support added in Python 2.7. */
|
/* "%lld" and "%llu" support added in Python 2.7. */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
CHECK_1_FORMAT("%llu", unsigned PY_LONG_LONG);
|
CHECK_1_FORMAT("%llu", unsigned PY_LONG_LONG);
|
||||||
CHECK_1_FORMAT("%lld", PY_LONG_LONG);
|
CHECK_1_FORMAT("%lld", PY_LONG_LONG);
|
||||||
#endif
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
|
@ -3991,14 +3981,12 @@ static PyMethodDef TestMethods[] = {
|
||||||
{"getargs_l", getargs_l, METH_VARARGS},
|
{"getargs_l", getargs_l, METH_VARARGS},
|
||||||
{"getargs_n", getargs_n, METH_VARARGS},
|
{"getargs_n", getargs_n, METH_VARARGS},
|
||||||
{"getargs_p", getargs_p, METH_VARARGS},
|
{"getargs_p", getargs_p, METH_VARARGS},
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
{"getargs_L", getargs_L, METH_VARARGS},
|
{"getargs_L", getargs_L, METH_VARARGS},
|
||||||
{"getargs_K", getargs_K, METH_VARARGS},
|
{"getargs_K", getargs_K, METH_VARARGS},
|
||||||
{"test_longlong_api", test_longlong_api, METH_NOARGS},
|
{"test_longlong_api", test_longlong_api, METH_NOARGS},
|
||||||
{"test_long_long_and_overflow",
|
{"test_long_long_and_overflow",
|
||||||
(PyCFunction)test_long_long_and_overflow, METH_NOARGS},
|
(PyCFunction)test_long_long_and_overflow, METH_NOARGS},
|
||||||
{"test_L_code", (PyCFunction)test_L_code, METH_NOARGS},
|
{"test_L_code", (PyCFunction)test_L_code, METH_NOARGS},
|
||||||
#endif
|
|
||||||
{"getargs_f", getargs_f, METH_VARARGS},
|
{"getargs_f", getargs_f, METH_VARARGS},
|
||||||
{"getargs_d", getargs_d, METH_VARARGS},
|
{"getargs_d", getargs_d, METH_VARARGS},
|
||||||
{"getargs_D", getargs_D, METH_VARARGS},
|
{"getargs_D", getargs_D, METH_VARARGS},
|
||||||
|
@ -4153,10 +4141,8 @@ typedef struct {
|
||||||
float float_member;
|
float float_member;
|
||||||
double double_member;
|
double double_member;
|
||||||
char inplace_member[6];
|
char inplace_member[6];
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG longlong_member;
|
PY_LONG_LONG longlong_member;
|
||||||
unsigned PY_LONG_LONG ulonglong_member;
|
unsigned PY_LONG_LONG ulonglong_member;
|
||||||
#endif
|
|
||||||
} all_structmembers;
|
} all_structmembers;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -4178,10 +4164,8 @@ static struct PyMemberDef test_members[] = {
|
||||||
{"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL},
|
{"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL},
|
||||||
{"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL},
|
{"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL},
|
||||||
{"T_STRING_INPLACE", T_STRING_INPLACE, offsetof(test_structmembers, structmembers.inplace_member), 0, NULL},
|
{"T_STRING_INPLACE", T_STRING_INPLACE, offsetof(test_structmembers, structmembers.inplace_member), 0, NULL},
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
{"T_LONGLONG", T_LONGLONG, offsetof(test_structmembers, structmembers.longlong_member), 0, NULL},
|
{"T_LONGLONG", T_LONGLONG, offsetof(test_structmembers, structmembers.longlong_member), 0, NULL},
|
||||||
{"T_ULONGLONG", T_ULONGLONG, offsetof(test_structmembers, structmembers.ulonglong_member), 0, NULL},
|
{"T_ULONGLONG", T_ULONGLONG, offsetof(test_structmembers, structmembers.ulonglong_member), 0, NULL},
|
||||||
#endif
|
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4193,15 +4177,9 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||||
"T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT",
|
"T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT",
|
||||||
"T_INT", "T_UINT", "T_LONG", "T_ULONG", "T_PYSSIZET",
|
"T_INT", "T_UINT", "T_LONG", "T_ULONG", "T_PYSSIZET",
|
||||||
"T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE",
|
"T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE",
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
"T_LONGLONG", "T_ULONGLONG",
|
"T_LONGLONG", "T_ULONGLONG",
|
||||||
#endif
|
|
||||||
NULL};
|
NULL};
|
||||||
static const char fmt[] = "|bbBhHiIlknfds#"
|
static const char fmt[] = "|bbBhHiIlknfds#LK";
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
"LK"
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
test_structmembers *ob;
|
test_structmembers *ob;
|
||||||
const char *s = NULL;
|
const char *s = NULL;
|
||||||
Py_ssize_t string_len = 0;
|
Py_ssize_t string_len = 0;
|
||||||
|
@ -4223,10 +4201,8 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||||
&ob->structmembers.float_member,
|
&ob->structmembers.float_member,
|
||||||
&ob->structmembers.double_member,
|
&ob->structmembers.double_member,
|
||||||
&s, &string_len
|
&s, &string_len
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
, &ob->structmembers.longlong_member,
|
, &ob->structmembers.longlong_member,
|
||||||
&ob->structmembers.ulonglong_member
|
&ob->structmembers.ulonglong_member
|
||||||
#endif
|
|
||||||
)) {
|
)) {
|
||||||
Py_DECREF(ob);
|
Py_DECREF(ob);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1182,10 +1182,8 @@ fromWideIntObj(PyObject* tkapp, Tcl_Obj *value)
|
||||||
{
|
{
|
||||||
Tcl_WideInt wideValue;
|
Tcl_WideInt wideValue;
|
||||||
if (Tcl_GetWideIntFromObj(Tkapp_Interp(tkapp), value, &wideValue) == TCL_OK) {
|
if (Tcl_GetWideIntFromObj(Tkapp_Interp(tkapp), value, &wideValue) == TCL_OK) {
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
if (sizeof(wideValue) <= SIZEOF_LONG_LONG)
|
if (sizeof(wideValue) <= SIZEOF_LONG_LONG)
|
||||||
return PyLong_FromLongLong(wideValue);
|
return PyLong_FromLongLong(wideValue);
|
||||||
#endif
|
|
||||||
return _PyLong_FromByteArray((unsigned char *)(void *)&wideValue,
|
return _PyLong_FromByteArray((unsigned char *)(void *)&wideValue,
|
||||||
sizeof(wideValue),
|
sizeof(wideValue),
|
||||||
PY_LITTLE_ENDIAN,
|
PY_LITTLE_ENDIAN,
|
||||||
|
|
|
@ -141,11 +141,7 @@ struct addrinfo {
|
||||||
* RFC 2553: protocol-independent placeholder for socket addresses
|
* RFC 2553: protocol-independent placeholder for socket addresses
|
||||||
*/
|
*/
|
||||||
#define _SS_MAXSIZE 128
|
#define _SS_MAXSIZE 128
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
|
#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG))
|
||||||
#else
|
|
||||||
#define _SS_ALIGNSIZE (sizeof(double))
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)
|
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2)
|
||||||
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \
|
#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \
|
||||||
_SS_PAD1SIZE - _SS_ALIGNSIZE)
|
_SS_PAD1SIZE - _SS_ALIGNSIZE)
|
||||||
|
@ -158,11 +154,7 @@ struct sockaddr_storage {
|
||||||
unsigned short ss_family; /* address family */
|
unsigned short ss_family; /* address family */
|
||||||
#endif /* HAVE_SOCKADDR_SA_LEN */
|
#endif /* HAVE_SOCKADDR_SA_LEN */
|
||||||
char __ss_pad1[_SS_PAD1SIZE];
|
char __ss_pad1[_SS_PAD1SIZE];
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG __ss_align; /* force desired structure storage alignment */
|
PY_LONG_LONG __ss_align; /* force desired structure storage alignment */
|
||||||
#else
|
|
||||||
double __ss_align; /* force desired structure storage alignment */
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
char __ss_pad2[_SS_PAD2SIZE];
|
char __ss_pad2[_SS_PAD2SIZE];
|
||||||
};
|
};
|
||||||
#endif /* !HAVE_SOCKADDR_STORAGE */
|
#endif /* !HAVE_SOCKADDR_STORAGE */
|
||||||
|
|
|
@ -418,8 +418,6 @@ LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
q_getitem(arrayobject *ap, Py_ssize_t i)
|
q_getitem(arrayobject *ap, Py_ssize_t i)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +467,6 @@ QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
||||||
((unsigned PY_LONG_LONG *)ap->ob_item)[i] = x;
|
((unsigned PY_LONG_LONG *)ap->ob_item)[i] = x;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
f_getitem(arrayobject *ap, Py_ssize_t i)
|
f_getitem(arrayobject *ap, Py_ssize_t i)
|
||||||
|
@ -521,10 +518,8 @@ static const struct arraydescr descriptors[] = {
|
||||||
{'I', sizeof(int), II_getitem, II_setitem, "I", 1, 0},
|
{'I', sizeof(int), II_getitem, II_setitem, "I", 1, 0},
|
||||||
{'l', sizeof(long), l_getitem, l_setitem, "l", 1, 1},
|
{'l', sizeof(long), l_getitem, l_setitem, "l", 1, 1},
|
||||||
{'L', sizeof(long), LL_getitem, LL_setitem, "L", 1, 0},
|
{'L', sizeof(long), LL_getitem, LL_setitem, "L", 1, 0},
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
{'q', sizeof(PY_LONG_LONG), q_getitem, q_setitem, "q", 1, 1},
|
{'q', sizeof(PY_LONG_LONG), q_getitem, q_setitem, "q", 1, 1},
|
||||||
{'Q', sizeof(PY_LONG_LONG), QQ_getitem, QQ_setitem, "Q", 1, 0},
|
{'Q', sizeof(PY_LONG_LONG), QQ_getitem, QQ_setitem, "Q", 1, 0},
|
||||||
#endif
|
|
||||||
{'f', sizeof(float), f_getitem, f_setitem, "f", 0, 0},
|
{'f', sizeof(float), f_getitem, f_setitem, "f", 0, 0},
|
||||||
{'d', sizeof(double), d_getitem, d_setitem, "d", 0, 0},
|
{'d', sizeof(double), d_getitem, d_setitem, "d", 0, 0},
|
||||||
{'\0', 0, 0, 0, 0, 0, 0} /* Sentinel */
|
{'\0', 0, 0, 0, 0, 0, 0} /* Sentinel */
|
||||||
|
@ -1814,7 +1809,6 @@ typecode_to_mformat_code(char typecode)
|
||||||
intsize = sizeof(long);
|
intsize = sizeof(long);
|
||||||
is_signed = 0;
|
is_signed = 0;
|
||||||
break;
|
break;
|
||||||
#if HAVE_LONG_LONG
|
|
||||||
case 'q':
|
case 'q':
|
||||||
intsize = sizeof(PY_LONG_LONG);
|
intsize = sizeof(PY_LONG_LONG);
|
||||||
is_signed = 1;
|
is_signed = 1;
|
||||||
|
@ -1823,7 +1817,6 @@ typecode_to_mformat_code(char typecode)
|
||||||
intsize = sizeof(PY_LONG_LONG);
|
intsize = sizeof(PY_LONG_LONG);
|
||||||
is_signed = 0;
|
is_signed = 0;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return UNKNOWN_FORMAT;
|
return UNKNOWN_FORMAT;
|
||||||
}
|
}
|
||||||
|
@ -2685,11 +2678,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
"bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)");
|
"bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)");
|
||||||
#else
|
|
||||||
"bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)");
|
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -640,22 +640,14 @@ fail:
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* MS_WINDOWS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
#define _PyLong_FromDev PyLong_FromLongLong
|
||||||
# define _PyLong_FromDev PyLong_FromLongLong
|
|
||||||
#else
|
|
||||||
# define _PyLong_FromDev PyLong_FromLong
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)
|
#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)
|
||||||
static int
|
static int
|
||||||
_Py_Dev_Converter(PyObject *obj, void *p)
|
_Py_Dev_Converter(PyObject *obj, void *p)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
*((dev_t *)p) = PyLong_AsUnsignedLongLong(obj);
|
*((dev_t *)p) = PyLong_AsUnsignedLongLong(obj);
|
||||||
#else
|
|
||||||
*((dev_t *)p) = PyLong_AsUnsignedLong(obj);
|
|
||||||
#endif
|
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -135,13 +135,11 @@ py2rlimit(PyObject *curobj, PyObject *maxobj, struct rlimit *rl_out)
|
||||||
static PyObject*
|
static PyObject*
|
||||||
rlimit2py(struct rlimit rl)
|
rlimit2py(struct rlimit rl)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_LONG_LONG)
|
|
||||||
if (sizeof(rl.rlim_cur) > sizeof(long)) {
|
if (sizeof(rl.rlim_cur) > sizeof(long)) {
|
||||||
return Py_BuildValue("LL",
|
return Py_BuildValue("LL",
|
||||||
(PY_LONG_LONG) rl.rlim_cur,
|
(PY_LONG_LONG) rl.rlim_cur,
|
||||||
(PY_LONG_LONG) rl.rlim_max);
|
(PY_LONG_LONG) rl.rlim_max);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max);
|
return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,11 +436,9 @@ PyInit_resource(void)
|
||||||
PyModule_AddIntMacro(m, RLIMIT_NPTS);
|
PyModule_AddIntMacro(m, RLIMIT_NPTS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_LONG_LONG)
|
|
||||||
if (sizeof(RLIM_INFINITY) > sizeof(long)) {
|
if (sizeof(RLIM_INFINITY) > sizeof(long)) {
|
||||||
v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);
|
v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
v = PyLong_FromLong((long) RLIM_INFINITY);
|
v = PyLong_FromLong((long) RLIM_INFINITY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -992,9 +992,6 @@ PyLong_FromVoidPtr(void *p)
|
||||||
return PyLong_FromUnsignedLong((unsigned long)(Py_uintptr_t)p);
|
return PyLong_FromUnsignedLong((unsigned long)(Py_uintptr_t)p);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef HAVE_LONG_LONG
|
|
||||||
# error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long), but no long long"
|
|
||||||
#endif
|
|
||||||
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
||||||
# error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
# error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1017,9 +1014,6 @@ PyLong_AsVoidPtr(PyObject *vv)
|
||||||
x = PyLong_AsUnsignedLong(vv);
|
x = PyLong_AsUnsignedLong(vv);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef HAVE_LONG_LONG
|
|
||||||
# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long"
|
|
||||||
#endif
|
|
||||||
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
||||||
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1037,8 +1031,6 @@ PyLong_AsVoidPtr(PyObject *vv)
|
||||||
return (void *)x;
|
return (void *)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
/* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later
|
/* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later
|
||||||
* rewritten to use the newer PyLong_{As,From}ByteArray API.
|
* rewritten to use the newer PyLong_{As,From}ByteArray API.
|
||||||
*/
|
*/
|
||||||
|
@ -1417,8 +1409,6 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
|
|
||||||
#define CHECK_BINOP(v,w) \
|
#define CHECK_BINOP(v,w) \
|
||||||
do { \
|
do { \
|
||||||
if (!PyLong_Check(v) || !PyLong_Check(w)) \
|
if (!PyLong_Check(v) || !PyLong_Check(w)) \
|
||||||
|
@ -3491,17 +3481,7 @@ long_mul(PyLongObject *a, PyLongObject *b)
|
||||||
/* fast path for single-digit multiplication */
|
/* fast path for single-digit multiplication */
|
||||||
if (Py_ABS(Py_SIZE(a)) <= 1 && Py_ABS(Py_SIZE(b)) <= 1) {
|
if (Py_ABS(Py_SIZE(a)) <= 1 && Py_ABS(Py_SIZE(b)) <= 1) {
|
||||||
stwodigits v = (stwodigits)(MEDIUM_VALUE(a)) * MEDIUM_VALUE(b);
|
stwodigits v = (stwodigits)(MEDIUM_VALUE(a)) * MEDIUM_VALUE(b);
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
return PyLong_FromLongLong((PY_LONG_LONG)v);
|
return PyLong_FromLongLong((PY_LONG_LONG)v);
|
||||||
#else
|
|
||||||
/* if we don't have long long then we're almost certainly
|
|
||||||
using 15-bit digits, so v will fit in a long. In the
|
|
||||||
unlikely event that we're using 30-bit digits on a platform
|
|
||||||
without long long, a large v will just cause us to fall
|
|
||||||
through to the general multiplication code below. */
|
|
||||||
if (v >= LONG_MIN && v <= LONG_MAX)
|
|
||||||
return PyLong_FromLong((long)v);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
z = k_mul(a, b);
|
z = k_mul(a, b);
|
||||||
|
|
|
@ -1111,9 +1111,7 @@ get_native_fmtchar(char *result, const char *fmt)
|
||||||
case 'h': case 'H': size = sizeof(short); break;
|
case 'h': case 'H': size = sizeof(short); break;
|
||||||
case 'i': case 'I': size = sizeof(int); break;
|
case 'i': case 'I': size = sizeof(int); break;
|
||||||
case 'l': case 'L': size = sizeof(long); break;
|
case 'l': case 'L': size = sizeof(long); break;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q': case 'Q': size = sizeof(PY_LONG_LONG); break;
|
case 'q': case 'Q': size = sizeof(PY_LONG_LONG); break;
|
||||||
#endif
|
|
||||||
case 'n': case 'N': size = sizeof(Py_ssize_t); break;
|
case 'n': case 'N': size = sizeof(Py_ssize_t); break;
|
||||||
case 'f': size = sizeof(float); break;
|
case 'f': size = sizeof(float); break;
|
||||||
case 'd': size = sizeof(double); break;
|
case 'd': size = sizeof(double); break;
|
||||||
|
@ -1158,10 +1156,8 @@ get_native_fmtstr(const char *fmt)
|
||||||
case 'I': RETURN("I");
|
case 'I': RETURN("I");
|
||||||
case 'l': RETURN("l");
|
case 'l': RETURN("l");
|
||||||
case 'L': RETURN("L");
|
case 'L': RETURN("L");
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q': RETURN("q");
|
case 'q': RETURN("q");
|
||||||
case 'Q': RETURN("Q");
|
case 'Q': RETURN("Q");
|
||||||
#endif
|
|
||||||
case 'n': RETURN("n");
|
case 'n': RETURN("n");
|
||||||
case 'N': RETURN("N");
|
case 'N': RETURN("N");
|
||||||
case 'f': RETURN("f");
|
case 'f': RETURN("f");
|
||||||
|
@ -1581,7 +1577,6 @@ pylong_as_lu(PyObject *item)
|
||||||
return lu;
|
return lu;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
static PY_LONG_LONG
|
static PY_LONG_LONG
|
||||||
pylong_as_lld(PyObject *item)
|
pylong_as_lld(PyObject *item)
|
||||||
{
|
{
|
||||||
|
@ -1611,7 +1606,6 @@ pylong_as_llu(PyObject *item)
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
return llu;
|
return llu;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static Py_ssize_t
|
static Py_ssize_t
|
||||||
pylong_as_zd(PyObject *item)
|
pylong_as_zd(PyObject *item)
|
||||||
|
@ -1691,10 +1685,8 @@ unpack_single(const char *ptr, const char *fmt)
|
||||||
case 'L': UNPACK_SINGLE(lu, ptr, unsigned long); goto convert_lu;
|
case 'L': UNPACK_SINGLE(lu, ptr, unsigned long); goto convert_lu;
|
||||||
|
|
||||||
/* native 64-bit */
|
/* native 64-bit */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q': UNPACK_SINGLE(lld, ptr, PY_LONG_LONG); goto convert_lld;
|
case 'q': UNPACK_SINGLE(lld, ptr, PY_LONG_LONG); goto convert_lld;
|
||||||
case 'Q': UNPACK_SINGLE(llu, ptr, unsigned PY_LONG_LONG); goto convert_llu;
|
case 'Q': UNPACK_SINGLE(llu, ptr, unsigned PY_LONG_LONG); goto convert_llu;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ssize_t and size_t */
|
/* ssize_t and size_t */
|
||||||
case 'n': UNPACK_SINGLE(zd, ptr, Py_ssize_t); goto convert_zd;
|
case 'n': UNPACK_SINGLE(zd, ptr, Py_ssize_t); goto convert_zd;
|
||||||
|
@ -1806,7 +1798,6 @@ pack_single(char *ptr, PyObject *item, const char *fmt)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* native 64-bit */
|
/* native 64-bit */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q':
|
case 'q':
|
||||||
lld = pylong_as_lld(item);
|
lld = pylong_as_lld(item);
|
||||||
if (lld == -1 && PyErr_Occurred())
|
if (lld == -1 && PyErr_Occurred())
|
||||||
|
@ -1819,7 +1810,6 @@ pack_single(char *ptr, PyObject *item, const char *fmt)
|
||||||
goto err_occurred;
|
goto err_occurred;
|
||||||
PACK_SINGLE(ptr, llu, unsigned PY_LONG_LONG);
|
PACK_SINGLE(ptr, llu, unsigned PY_LONG_LONG);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ssize_t and size_t */
|
/* ssize_t and size_t */
|
||||||
case 'n':
|
case 'n':
|
||||||
|
@ -2656,10 +2646,8 @@ unpack_cmp(const char *p, const char *q, char fmt,
|
||||||
case 'L': CMP_SINGLE(p, q, unsigned long); return equal;
|
case 'L': CMP_SINGLE(p, q, unsigned long); return equal;
|
||||||
|
|
||||||
/* native 64-bit */
|
/* native 64-bit */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'q': CMP_SINGLE(p, q, PY_LONG_LONG); return equal;
|
case 'q': CMP_SINGLE(p, q, PY_LONG_LONG); return equal;
|
||||||
case 'Q': CMP_SINGLE(p, q, unsigned PY_LONG_LONG); return equal;
|
case 'Q': CMP_SINGLE(p, q, unsigned PY_LONG_LONG); return equal;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ssize_t and size_t */
|
/* ssize_t and size_t */
|
||||||
case 'n': CMP_SINGLE(p, q, Py_ssize_t); return equal;
|
case 'n': CMP_SINGLE(p, q, Py_ssize_t); return equal;
|
||||||
|
|
|
@ -2636,13 +2636,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
||||||
longflag = 1;
|
longflag = 1;
|
||||||
++f;
|
++f;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
else if (f[1] == 'l' &&
|
else if (f[1] == 'l' &&
|
||||||
(f[2] == 'd' || f[2] == 'u' || f[2] == 'i')) {
|
(f[2] == 'd' || f[2] == 'u' || f[2] == 'i')) {
|
||||||
longlongflag = 1;
|
longlongflag = 1;
|
||||||
f += 2;
|
f += 2;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/* handle the size_t flag. */
|
/* handle the size_t flag. */
|
||||||
else if (*f == 'z' && (f[1] == 'd' || f[1] == 'u' || f[1] == 'i')) {
|
else if (*f == 'z' && (f[1] == 'd' || f[1] == 'u' || f[1] == 'i')) {
|
||||||
|
@ -2680,11 +2678,9 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
||||||
if (longflag)
|
if (longflag)
|
||||||
len = sprintf(buffer, "%lu",
|
len = sprintf(buffer, "%lu",
|
||||||
va_arg(*vargs, unsigned long));
|
va_arg(*vargs, unsigned long));
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
else if (longlongflag)
|
else if (longlongflag)
|
||||||
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "u",
|
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "u",
|
||||||
va_arg(*vargs, unsigned PY_LONG_LONG));
|
va_arg(*vargs, unsigned PY_LONG_LONG));
|
||||||
#endif
|
|
||||||
else if (size_tflag)
|
else if (size_tflag)
|
||||||
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "u",
|
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "u",
|
||||||
va_arg(*vargs, size_t));
|
va_arg(*vargs, size_t));
|
||||||
|
@ -2699,11 +2695,9 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
||||||
if (longflag)
|
if (longflag)
|
||||||
len = sprintf(buffer, "%li",
|
len = sprintf(buffer, "%li",
|
||||||
va_arg(*vargs, long));
|
va_arg(*vargs, long));
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
else if (longlongflag)
|
else if (longlongflag)
|
||||||
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "i",
|
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "i",
|
||||||
va_arg(*vargs, PY_LONG_LONG));
|
va_arg(*vargs, PY_LONG_LONG));
|
||||||
#endif
|
|
||||||
else if (size_tflag)
|
else if (size_tflag)
|
||||||
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "i",
|
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "i",
|
||||||
va_arg(*vargs, Py_ssize_t));
|
va_arg(*vargs, Py_ssize_t));
|
||||||
|
|
|
@ -769,7 +769,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'L': {/* PY_LONG_LONG */
|
case 'L': {/* PY_LONG_LONG */
|
||||||
PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * );
|
PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * );
|
||||||
PY_LONG_LONG ival;
|
PY_LONG_LONG ival;
|
||||||
|
@ -793,7 +792,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
*p = ival;
|
*p = ival;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
case 'f': {/* float */
|
case 'f': {/* float */
|
||||||
float *p = va_arg(*p_va, float *);
|
float *p = va_arg(*p_va, float *);
|
||||||
|
@ -2088,10 +2086,8 @@ skipitem(const char **p_format, va_list *p_va, int flags)
|
||||||
case 'I': /* int sized bitfield */
|
case 'I': /* int sized bitfield */
|
||||||
case 'l': /* long int */
|
case 'l': /* long int */
|
||||||
case 'k': /* long int sized bitfield */
|
case 'k': /* long int sized bitfield */
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'L': /* PY_LONG_LONG */
|
case 'L': /* PY_LONG_LONG */
|
||||||
case 'K': /* PY_LONG_LONG sized bitfield */
|
case 'K': /* PY_LONG_LONG sized bitfield */
|
||||||
#endif
|
|
||||||
case 'n': /* Py_ssize_t */
|
case 'n': /* Py_ssize_t */
|
||||||
case 'f': /* float */
|
case 'f': /* float */
|
||||||
case 'd': /* double */
|
case 'd': /* double */
|
||||||
|
|
|
@ -260,13 +260,12 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
|
||||||
return PyLong_FromUnsignedLong(n);
|
return PyLong_FromUnsignedLong(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case 'L':
|
case 'L':
|
||||||
return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG));
|
return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG));
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG));
|
return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG));
|
||||||
#endif
|
|
||||||
case 'u':
|
case 'u':
|
||||||
{
|
{
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
|
|
@ -38,7 +38,7 @@ error_time_t_overflow(void)
|
||||||
time_t
|
time_t
|
||||||
_PyLong_AsTime_t(PyObject *obj)
|
_PyLong_AsTime_t(PyObject *obj)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_LONG_LONG) && SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
#if SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
||||||
PY_LONG_LONG val;
|
PY_LONG_LONG val;
|
||||||
val = PyLong_AsLongLong(obj);
|
val = PyLong_AsLongLong(obj);
|
||||||
#else
|
#else
|
||||||
|
@ -57,7 +57,7 @@ _PyLong_AsTime_t(PyObject *obj)
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyLong_FromTime_t(time_t t)
|
_PyLong_FromTime_t(time_t t)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_LONG_LONG) && SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
#if SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
||||||
return PyLong_FromLongLong((PY_LONG_LONG)t);
|
return PyLong_FromLongLong((PY_LONG_LONG)t);
|
||||||
#else
|
#else
|
||||||
Py_BUILD_ASSERT(sizeof(time_t) <= sizeof(long));
|
Py_BUILD_ASSERT(sizeof(time_t) <= sizeof(long));
|
||||||
|
@ -304,17 +304,10 @@ _PyTime_FromObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round,
|
||||||
return _PyTime_FromFloatObject(t, d, round, unit_to_ns);
|
return _PyTime_FromFloatObject(t, d, round, unit_to_ns);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
PY_LONG_LONG sec;
|
PY_LONG_LONG sec;
|
||||||
Py_BUILD_ASSERT(sizeof(PY_LONG_LONG) <= sizeof(_PyTime_t));
|
Py_BUILD_ASSERT(sizeof(PY_LONG_LONG) <= sizeof(_PyTime_t));
|
||||||
|
|
||||||
sec = PyLong_AsLongLong(obj);
|
sec = PyLong_AsLongLong(obj);
|
||||||
#else
|
|
||||||
long sec;
|
|
||||||
Py_BUILD_ASSERT(sizeof(PY_LONG_LONG) <= sizeof(_PyTime_t));
|
|
||||||
|
|
||||||
sec = PyLong_AsLong(obj);
|
|
||||||
#endif
|
|
||||||
if (sec == -1 && PyErr_Occurred()) {
|
if (sec == -1 && PyErr_Occurred()) {
|
||||||
if (PyErr_ExceptionMatches(PyExc_OverflowError))
|
if (PyErr_ExceptionMatches(PyExc_OverflowError))
|
||||||
_PyTime_overflow();
|
_PyTime_overflow();
|
||||||
|
@ -365,13 +358,8 @@ _PyTime_AsSecondsDouble(_PyTime_t t)
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyTime_AsNanosecondsObject(_PyTime_t t)
|
_PyTime_AsNanosecondsObject(_PyTime_t t)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
Py_BUILD_ASSERT(sizeof(PY_LONG_LONG) >= sizeof(_PyTime_t));
|
Py_BUILD_ASSERT(sizeof(PY_LONG_LONG) >= sizeof(_PyTime_t));
|
||||||
return PyLong_FromLongLong((PY_LONG_LONG)t);
|
return PyLong_FromLongLong((PY_LONG_LONG)t);
|
||||||
#else
|
|
||||||
Py_BUILD_ASSERT(sizeof(long) >= sizeof(_PyTime_t));
|
|
||||||
return PyLong_FromLong((long)t);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static _PyTime_t
|
static _PyTime_t
|
||||||
|
|
|
@ -74,14 +74,12 @@ PyMember_GetOne(const char *addr, PyMemberDef *l)
|
||||||
PyErr_SetString(PyExc_AttributeError, l->name);
|
PyErr_SetString(PyExc_AttributeError, l->name);
|
||||||
Py_XINCREF(v);
|
Py_XINCREF(v);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case T_LONGLONG:
|
case T_LONGLONG:
|
||||||
v = PyLong_FromLongLong(*(PY_LONG_LONG *)addr);
|
v = PyLong_FromLongLong(*(PY_LONG_LONG *)addr);
|
||||||
break;
|
break;
|
||||||
case T_ULONGLONG:
|
case T_ULONGLONG:
|
||||||
v = PyLong_FromUnsignedLongLong(*(unsigned PY_LONG_LONG *)addr);
|
v = PyLong_FromUnsignedLongLong(*(unsigned PY_LONG_LONG *)addr);
|
||||||
break;
|
break;
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
case T_NONE:
|
case T_NONE:
|
||||||
v = Py_None;
|
v = Py_None;
|
||||||
Py_INCREF(v);
|
Py_INCREF(v);
|
||||||
|
@ -266,7 +264,6 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
||||||
case T_STRING_INPLACE:
|
case T_STRING_INPLACE:
|
||||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||||
return -1;
|
return -1;
|
||||||
#ifdef HAVE_LONG_LONG
|
|
||||||
case T_LONGLONG:{
|
case T_LONGLONG:{
|
||||||
PY_LONG_LONG value;
|
PY_LONG_LONG value;
|
||||||
*(PY_LONG_LONG*)addr = value = PyLong_AsLongLong(v);
|
*(PY_LONG_LONG*)addr = value = PyLong_AsLongLong(v);
|
||||||
|
@ -286,7 +283,6 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LONG_LONG */
|
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_SystemError,
|
PyErr_Format(PyExc_SystemError,
|
||||||
"bad memberdescr type for %s", l->name);
|
"bad memberdescr type for %s", l->name);
|
||||||
|
|
|
@ -775,6 +775,7 @@ infodir
|
||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
|
runstatedir
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
|
@ -885,6 +886,7 @@ datadir='${datarootdir}'
|
||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
|
runstatedir='${localstatedir}/run'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||||
|
@ -1137,6 +1139,15 @@ do
|
||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
|
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||||
|
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||||
|
| --run | --ru | --r)
|
||||||
|
ac_prev=runstatedir ;;
|
||||||
|
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||||
|
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||||
|
| --run=* | --ru=* | --r=*)
|
||||||
|
runstatedir=$ac_optarg ;;
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
|
@ -1274,7 +1285,7 @@ fi
|
||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir
|
libdir localedir mandir runstatedir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
|
@ -1427,6 +1438,7 @@ Fine tuning of the installation directories:
|
||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
|
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
|
@ -8290,6 +8302,39 @@ cat >>confdefs.h <<_ACEOF
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
# The cast to long int works around a bug in the HP C Compiler
|
||||||
|
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||||
|
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||||
|
# This bug is HP SR number 8606223364.
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
|
||||||
|
$as_echo_n "checking size of long long... " >&6; }
|
||||||
|
if ${ac_cv_sizeof_long_long+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
|
||||||
|
|
||||||
|
else
|
||||||
|
if test "$ac_cv_type_long_long" = yes; then
|
||||||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||||
|
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||||
|
as_fn_error 77 "cannot compute sizeof (long long)
|
||||||
|
See \`config.log' for more details" "$LINENO" 5; }
|
||||||
|
else
|
||||||
|
ac_cv_sizeof_long_long=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
|
||||||
|
$as_echo "$ac_cv_sizeof_long_long" >&6; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
# The cast to long int works around a bug in the HP C Compiler
|
# The cast to long int works around a bug in the HP C Compiler
|
||||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||||
|
@ -8522,67 +8567,6 @@ _ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long support" >&5
|
|
||||||
$as_echo_n "checking for long long support... " >&6; }
|
|
||||||
have_long_long=no
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
long long x; x = (long long)0;
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"; then :
|
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_LONG_LONG 1" >>confdefs.h
|
|
||||||
|
|
||||||
have_long_long=yes
|
|
||||||
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_long_long" >&5
|
|
||||||
$as_echo "$have_long_long" >&6; }
|
|
||||||
if test "$have_long_long" = yes ; then
|
|
||||||
# The cast to long int works around a bug in the HP C Compiler
|
|
||||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
|
||||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
|
||||||
# This bug is HP SR number 8606223364.
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
|
|
||||||
$as_echo_n "checking size of long long... " >&6; }
|
|
||||||
if ${ac_cv_sizeof_long_long+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
|
|
||||||
|
|
||||||
else
|
|
||||||
if test "$ac_cv_type_long_long" = yes; then
|
|
||||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
|
||||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
|
||||||
as_fn_error 77 "cannot compute sizeof (long long)
|
|
||||||
See \`config.log' for more details" "$LINENO" 5; }
|
|
||||||
else
|
|
||||||
ac_cv_sizeof_long_long=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
|
|
||||||
$as_echo "$ac_cv_sizeof_long_long" >&6; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double support" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double support" >&5
|
||||||
$as_echo_n "checking for long double support... " >&6; }
|
$as_echo_n "checking for long double support... " >&6; }
|
||||||
have_long_double=no
|
have_long_double=no
|
||||||
|
@ -8796,8 +8780,6 @@ _ACEOF
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable large file support" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable large file support" >&5
|
||||||
$as_echo_n "checking whether to enable large file support... " >&6; }
|
$as_echo_n "checking whether to enable large file support... " >&6; }
|
||||||
if test "$have_long_long" = yes
|
|
||||||
then
|
|
||||||
if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
|
if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
|
||||||
"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
|
"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
|
||||||
|
|
||||||
|
@ -8809,10 +8791,6 @@ else
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
$as_echo "no" >&6; }
|
$as_echo "no" >&6; }
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The cast to long int works around a bug in the HP C Compiler
|
# The cast to long int works around a bug in the HP C Compiler
|
||||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||||
|
@ -15853,32 +15831,30 @@ $as_echo "#define HAVE_DEV_PTC 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$have_long_long" = yes
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5
|
||||||
then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5
|
|
||||||
$as_echo_n "checking for %lld and %llu printf() format support... " >&6; }
|
$as_echo_n "checking for %lld and %llu printf() format support... " >&6; }
|
||||||
if ${ac_cv_have_long_long_format+:} false; then :
|
if ${ac_cv_have_long_long_format+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
if test "$cross_compiling" = yes; then :
|
if test "$cross_compiling" = yes; then :
|
||||||
ac_cv_have_long_long_format="cross -- assuming no"
|
ac_cv_have_long_long_format="cross -- assuming no"
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes; then
|
||||||
save_CFLAGS=$CFLAGS
|
save_CFLAGS=$CFLAGS
|
||||||
CFLAGS="$CFLAGS -Werror -Wformat"
|
CFLAGS="$CFLAGS -Werror -Wformat"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
|
||||||
char *buffer;
|
char *buffer;
|
||||||
sprintf(buffer, "%lld", (long long)123);
|
sprintf(buffer, "%lld", (long long)123);
|
||||||
sprintf(buffer, "%lld", (long long)-123);
|
sprintf(buffer, "%lld", (long long)-123);
|
||||||
sprintf(buffer, "%llu", (unsigned long long)123);
|
sprintf(buffer, "%llu", (unsigned long long)123);
|
||||||
|
|
||||||
;
|
;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -15889,41 +15865,41 @@ if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
CFLAGS=$save_CFLAGS
|
CFLAGS=$save_CFLAGS
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
if (sprintf(buffer, "%lld", (long long)123) < 0)
|
if (sprintf(buffer, "%lld", (long long)123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "123"))
|
if (strcmp(buffer, "123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (sprintf(buffer, "%lld", (long long)-123) < 0)
|
if (sprintf(buffer, "%lld", (long long)-123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "-123"))
|
if (strcmp(buffer, "-123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
|
if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "123"))
|
if (strcmp(buffer, "123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_run "$LINENO"; then :
|
if ac_fn_c_try_run "$LINENO"; then :
|
||||||
|
@ -15938,9 +15914,8 @@ fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_long_long_format" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_long_long_format" >&5
|
||||||
$as_echo "$ac_cv_have_long_long_format" >&6; }
|
$as_echo "$ac_cv_have_long_long_format" >&6; }
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ac_cv_have_long_long_format" = yes
|
if test "$ac_cv_have_long_long_format" = yes
|
||||||
then
|
then
|
||||||
|
|
116
configure.ac
116
configure.ac
|
@ -2092,6 +2092,7 @@ AC_CHECK_TYPE(__uint128_t,
|
||||||
# ANSI C requires sizeof(char) == 1, so no need to check it
|
# ANSI C requires sizeof(char) == 1, so no need to check it
|
||||||
AC_CHECK_SIZEOF(int, 4)
|
AC_CHECK_SIZEOF(int, 4)
|
||||||
AC_CHECK_SIZEOF(long, 4)
|
AC_CHECK_SIZEOF(long, 4)
|
||||||
|
AC_CHECK_SIZEOF(long long, 8)
|
||||||
AC_CHECK_SIZEOF(void *, 4)
|
AC_CHECK_SIZEOF(void *, 4)
|
||||||
AC_CHECK_SIZEOF(short, 2)
|
AC_CHECK_SIZEOF(short, 2)
|
||||||
AC_CHECK_SIZEOF(float, 4)
|
AC_CHECK_SIZEOF(float, 4)
|
||||||
|
@ -2100,17 +2101,6 @@ AC_CHECK_SIZEOF(fpos_t, 4)
|
||||||
AC_CHECK_SIZEOF(size_t, 4)
|
AC_CHECK_SIZEOF(size_t, 4)
|
||||||
AC_CHECK_SIZEOF(pid_t, 4)
|
AC_CHECK_SIZEOF(pid_t, 4)
|
||||||
|
|
||||||
AC_MSG_CHECKING(for long long support)
|
|
||||||
have_long_long=no
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
|
|
||||||
AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
|
|
||||||
have_long_long=yes
|
|
||||||
],[])
|
|
||||||
AC_MSG_RESULT($have_long_long)
|
|
||||||
if test "$have_long_long" = yes ; then
|
|
||||||
AC_CHECK_SIZEOF(long long, 8)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for long double support)
|
AC_MSG_CHECKING(for long double support)
|
||||||
have_long_double=no
|
have_long_double=no
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
|
||||||
|
@ -2150,8 +2140,6 @@ AC_CHECK_SIZEOF(off_t, [], [
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to enable large file support)
|
AC_MSG_CHECKING(whether to enable large file support)
|
||||||
if test "$have_long_long" = yes
|
|
||||||
then
|
|
||||||
if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
|
if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
|
||||||
"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
|
"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
|
||||||
AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
|
AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
|
||||||
|
@ -2163,9 +2151,6 @@ if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(time_t, [], [
|
AC_CHECK_SIZEOF(time_t, [], [
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
@ -4925,63 +4910,60 @@ if test "x$ac_cv_file__dev_ptc" = xyes; then
|
||||||
[Define to 1 if you have the /dev/ptc device file.])
|
[Define to 1 if you have the /dev/ptc device file.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$have_long_long" = yes
|
AC_MSG_CHECKING(for %lld and %llu printf() format support)
|
||||||
then
|
AC_CACHE_VAL(ac_cv_have_long_long_format,
|
||||||
AC_MSG_CHECKING(for %lld and %llu printf() format support)
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[[
|
||||||
AC_CACHE_VAL(ac_cv_have_long_long_format,
|
#include <stdio.h>
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[[
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
if (sprintf(buffer, "%lld", (long long)123) < 0)
|
if (sprintf(buffer, "%lld", (long long)123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "123"))
|
if (strcmp(buffer, "123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (sprintf(buffer, "%lld", (long long)-123) < 0)
|
if (sprintf(buffer, "%lld", (long long)-123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "-123"))
|
if (strcmp(buffer, "-123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
|
if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (strcmp(buffer, "123"))
|
if (strcmp(buffer, "123"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
]]])],
|
]]])],
|
||||||
[ac_cv_have_long_long_format=yes],
|
[ac_cv_have_long_long_format=yes],
|
||||||
[ac_cv_have_long_long_format=no],
|
[ac_cv_have_long_long_format=no],
|
||||||
[ac_cv_have_long_long_format="cross -- assuming no"
|
[ac_cv_have_long_long_format="cross -- assuming no"
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes; then
|
||||||
save_CFLAGS=$CFLAGS
|
save_CFLAGS=$CFLAGS
|
||||||
CFLAGS="$CFLAGS -Werror -Wformat"
|
CFLAGS="$CFLAGS -Werror -Wformat"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
]], [[
|
]], [[
|
||||||
char *buffer;
|
char *buffer;
|
||||||
sprintf(buffer, "%lld", (long long)123);
|
sprintf(buffer, "%lld", (long long)123);
|
||||||
sprintf(buffer, "%lld", (long long)-123);
|
sprintf(buffer, "%lld", (long long)-123);
|
||||||
sprintf(buffer, "%llu", (unsigned long long)123);
|
sprintf(buffer, "%llu", (unsigned long long)123);
|
||||||
]])],
|
]])],
|
||||||
ac_cv_have_long_long_format=yes
|
ac_cv_have_long_long_format=yes
|
||||||
)
|
)
|
||||||
CFLAGS=$save_CFLAGS
|
CFLAGS=$save_CFLAGS
|
||||||
fi])
|
fi])
|
||||||
)
|
)
|
||||||
AC_MSG_RESULT($ac_cv_have_long_long_format)
|
AC_MSG_RESULT($ac_cv_have_long_long_format)
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ac_cv_have_long_long_format" = yes
|
if test "$ac_cv_have_long_long_format" = yes
|
||||||
then
|
then
|
||||||
|
|
|
@ -592,9 +592,6 @@
|
||||||
/* Define this if you have the type long double. */
|
/* Define this if you have the type long double. */
|
||||||
#undef HAVE_LONG_DOUBLE
|
#undef HAVE_LONG_DOUBLE
|
||||||
|
|
||||||
/* Define this if you have the type long long. */
|
|
||||||
#undef HAVE_LONG_LONG
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `lstat' function. */
|
/* Define to 1 if you have the `lstat' function. */
|
||||||
#undef HAVE_LSTAT
|
#undef HAVE_LSTAT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue