Merged revisions 81036 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81036 | mark.dickinson | 2010-05-09 21:30:29 +0100 (Sun, 09 May 2010) | 1 line

  Post-detabification cleanup:  whitespace fixes and long line rewraps only.
........
This commit is contained in:
Mark Dickinson 2010-05-10 21:27:53 +00:00
parent e43baaba73
commit 22b20183d5
1 changed files with 101 additions and 102 deletions

View File

@ -516,7 +516,8 @@ PyLong_AsUnsignedLong(PyObject *vv)
x = (x << PyLong_SHIFT) | v->ob_digit[i]; x = (x << PyLong_SHIFT) | v->ob_digit[i];
if ((x >> PyLong_SHIFT) != prev) { if ((x >> PyLong_SHIFT) != prev) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"python int too large to convert to C unsigned long"); "python int too large to convert "
"to C unsigned long");
return (unsigned long) -1; return (unsigned long) -1;
} }
} }
@ -769,8 +770,7 @@ _PyLong_FromByteArray(const unsigned char* bytes, size_t n,
if (accumbits >= PyLong_SHIFT) { if (accumbits >= PyLong_SHIFT) {
/* There's enough to fill a Python digit. */ /* There's enough to fill a Python digit. */
assert(idigit < ndigits); assert(idigit < ndigits);
v->ob_digit[idigit] = (digit)(accum & v->ob_digit[idigit] = (digit)(accum & PyLong_MASK);
PyLong_MASK);
++idigit; ++idigit;
accum >>= PyLong_SHIFT; accum >>= PyLong_SHIFT;
accumbits -= PyLong_SHIFT; accumbits -= PyLong_SHIFT;
@ -856,8 +856,7 @@ _PyLong_AsByteArray(PyLongObject* v,
/* Count # of sign bits -- they needn't be stored, /* Count # of sign bits -- they needn't be stored,
* although for signed conversion we need later to * although for signed conversion we need later to
* make sure at least one sign bit gets stored. */ * make sure at least one sign bit gets stored. */
digit s = do_twos_comp ? thisdigit ^ PyLong_MASK : digit s = do_twos_comp ? thisdigit ^ PyLong_MASK : thisdigit;
thisdigit;
while (s != 0) { while (s != 0) {
s >>= 1; s >>= 1;
accumbits++; accumbits++;
@ -1172,8 +1171,7 @@ PyLong_AsLongLong(PyObject *vv)
case 0: return 0; case 0: return 0;
case 1: return v->ob_digit[0]; case 1: return v->ob_digit[0];
} }
res = _PyLong_AsByteArray( res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
(PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1);
/* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */
@ -1205,8 +1203,7 @@ PyLong_AsUnsignedLongLong(PyObject *vv)
case 1: return v->ob_digit[0]; case 1: return v->ob_digit[0];
} }
res = _PyLong_AsByteArray( res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
(PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0);
/* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */
@ -1998,8 +1995,8 @@ digit beyond the first.
twodigits convmax = base; twodigits convmax = base;
int i = 1; int i = 1;
log_base_BASE[base] = log((double)base) / log_base_BASE[base] = (log((double)base) /
log((double)PyLong_BASE); log((double)PyLong_BASE));
for (;;) { for (;;) {
twodigits next = convmax * base; twodigits next = convmax * base;
if (next > PyLong_BASE) if (next > PyLong_BASE)
@ -2428,7 +2425,8 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
break; break;
} }
} }
assert(1 <= x_size && x_size <= (Py_ssize_t)(sizeof(x_digits)/sizeof(digit))); assert(1 <= x_size &&
x_size <= (Py_ssize_t)(sizeof(x_digits)/sizeof(digit)));
/* Round, and convert to double. */ /* Round, and convert to double. */
x_digits[0] += half_even_correction[x_digits[0] & 7]; x_digits[0] += half_even_correction[x_digits[0] & 7];
@ -2832,7 +2830,10 @@ x_mul(PyLongObject *a, PyLongObject *b)
Returns 0 on success, -1 on failure. Returns 0 on success, -1 on failure.
*/ */
static int static int
kmul_split(PyLongObject *n, Py_ssize_t size, PyLongObject **high, PyLongObject **low) kmul_split(PyLongObject *n,
Py_ssize_t size,
PyLongObject **high,
PyLongObject **low)
{ {
PyLongObject *hi, *lo; PyLongObject *hi, *lo;
Py_ssize_t size_lo, size_hi; Py_ssize_t size_lo, size_hi;
@ -3819,8 +3820,7 @@ long_rshift(PyLongObject *a, PyLongObject *b)
for (i = 0, j = wordshift; i < newsize; i++, j++) { for (i = 0, j = wordshift; i < newsize; i++, j++) {
z->ob_digit[i] = (a->ob_digit[j] >> loshift) & lomask; z->ob_digit[i] = (a->ob_digit[j] >> loshift) & lomask;
if (i+1 < newsize) if (i+1 < newsize)
z->ob_digit[i] |= z->ob_digit[i] |= (a->ob_digit[j+1] << hishift) & himask;
(a->ob_digit[j+1] << hishift) & himask;
} }
z = long_normalize(z); z = long_normalize(z);
} }
@ -4722,8 +4722,7 @@ internal representation of integers. The attributes are read only.");
static PyStructSequence_Field int_info_fields[] = { static PyStructSequence_Field int_info_fields[] = {
{"bits_per_digit", "size of a digit in bits"}, {"bits_per_digit", "size of a digit in bits"},
{"sizeof_digit", "size in bytes of the C type used to " {"sizeof_digit", "size in bytes of the C type used to represent a digit"},
"represent a digit"},
{NULL, NULL} {NULL, NULL}
}; };