diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-09-06 00:44:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-09-06 00:44:18 (GMT) |
commit | ed4aa83ff77ff11059f64dab711adf35ce9d0e0f (patch) | |
tree | cf430f6a641782d7c794c1adc73c055a3f120a69 /Objects | |
parent | b3b0767861c69115a1482e3ade8d29207e204b15 (diff) | |
download | cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.zip cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.tar.gz cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.tar.bz2 |
require a long long data type (closes #27961)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 20 | ||||
-rw-r--r-- | Objects/memoryobject.c | 12 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 6 |
3 files changed, 0 insertions, 38 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 4ace778..150953b 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -992,9 +992,6 @@ PyLong_FromVoidPtr(void *p) return PyLong_FromUnsignedLong((unsigned long)(Py_uintptr_t)p); #else -#ifndef HAVE_LONG_LONG -# error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long), but no long long" -#endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P # error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif @@ -1017,9 +1014,6 @@ PyLong_AsVoidPtr(PyObject *vv) x = PyLong_AsUnsignedLong(vv); #else -#ifndef HAVE_LONG_LONG -# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" -#endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif @@ -1037,8 +1031,6 @@ PyLong_AsVoidPtr(PyObject *vv) return (void *)x; } -#ifdef HAVE_LONG_LONG - /* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later * rewritten to use the newer PyLong_{As,From}ByteArray API. */ @@ -1417,8 +1409,6 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow) return res; } -#endif /* HAVE_LONG_LONG */ - #define CHECK_BINOP(v,w) \ do { \ if (!PyLong_Check(v) || !PyLong_Check(w)) \ @@ -3491,17 +3481,7 @@ long_mul(PyLongObject *a, PyLongObject *b) /* fast path for single-digit multiplication */ if (Py_ABS(Py_SIZE(a)) <= 1 && Py_ABS(Py_SIZE(b)) <= 1) { stwodigits v = (stwodigits)(MEDIUM_VALUE(a)) * MEDIUM_VALUE(b); -#ifdef HAVE_LONG_LONG 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); diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index e355a83..adf3ec6 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -1111,9 +1111,7 @@ get_native_fmtchar(char *result, const char *fmt) case 'h': case 'H': size = sizeof(short); break; case 'i': case 'I': size = sizeof(int); break; case 'l': case 'L': size = sizeof(long); break; - #ifdef HAVE_LONG_LONG case 'q': case 'Q': size = sizeof(PY_LONG_LONG); break; - #endif case 'n': case 'N': size = sizeof(Py_ssize_t); break; case 'f': size = sizeof(float); break; case 'd': size = sizeof(double); break; @@ -1158,10 +1156,8 @@ get_native_fmtstr(const char *fmt) case 'I': RETURN("I"); case 'l': RETURN("l"); case 'L': RETURN("L"); - #ifdef HAVE_LONG_LONG case 'q': RETURN("q"); case 'Q': RETURN("Q"); - #endif case 'n': RETURN("n"); case 'N': RETURN("N"); case 'f': RETURN("f"); @@ -1581,7 +1577,6 @@ pylong_as_lu(PyObject *item) return lu; } -#ifdef HAVE_LONG_LONG static PY_LONG_LONG pylong_as_lld(PyObject *item) { @@ -1611,7 +1606,6 @@ pylong_as_llu(PyObject *item) Py_DECREF(tmp); return llu; } -#endif static Py_ssize_t 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; /* native 64-bit */ - #ifdef HAVE_LONG_LONG 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; - #endif /* ssize_t and size_t */ 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; /* native 64-bit */ - #ifdef HAVE_LONG_LONG case 'q': lld = pylong_as_lld(item); if (lld == -1 && PyErr_Occurred()) @@ -1819,7 +1810,6 @@ pack_single(char *ptr, PyObject *item, const char *fmt) goto err_occurred; PACK_SINGLE(ptr, llu, unsigned PY_LONG_LONG); break; - #endif /* ssize_t and size_t */ 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; /* native 64-bit */ - #ifdef HAVE_LONG_LONG case 'q': CMP_SINGLE(p, q, PY_LONG_LONG); return equal; case 'Q': CMP_SINGLE(p, q, unsigned PY_LONG_LONG); return equal; - #endif /* ssize_t and size_t */ case 'n': CMP_SINGLE(p, q, Py_ssize_t); return equal; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 0f27406..7ea1639 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2636,13 +2636,11 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer, longflag = 1; ++f; } -#ifdef HAVE_LONG_LONG else if (f[1] == 'l' && (f[2] == 'd' || f[2] == 'u' || f[2] == 'i')) { longlongflag = 1; f += 2; } -#endif } /* handle the size_t flag. */ else if (*f == 'z' && (f[1] == 'd' || f[1] == 'u' || f[1] == 'i')) { @@ -2680,11 +2678,9 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer, if (longflag) len = sprintf(buffer, "%lu", va_arg(*vargs, unsigned long)); -#ifdef HAVE_LONG_LONG else if (longlongflag) len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "u", va_arg(*vargs, unsigned PY_LONG_LONG)); -#endif else if (size_tflag) len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "u", va_arg(*vargs, size_t)); @@ -2699,11 +2695,9 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer, if (longflag) len = sprintf(buffer, "%li", va_arg(*vargs, long)); -#ifdef HAVE_LONG_LONG else if (longlongflag) len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "i", va_arg(*vargs, PY_LONG_LONG)); -#endif else if (size_tflag) len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "i", va_arg(*vargs, Py_ssize_t)); |