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];
if ((x >> PyLong_SHIFT) != prev) {
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;
}
}
@ -671,7 +672,7 @@ _PyLong_NumBits(PyObject *vv)
}
return result;
Overflow:
Overflow:
PyErr_SetString(PyExc_OverflowError, "int has too many bits "
"to express in a platform size_t");
return (size_t)-1;
@ -681,7 +682,7 @@ PyObject *
_PyLong_FromByteArray(const unsigned char* bytes, size_t n,
int little_endian, int is_signed)
{
const unsigned char* pstartbyte;/* LSB of bytes */
const unsigned char* pstartbyte; /* LSB of bytes */
int incr; /* direction to move pstartbyte */
const unsigned char* pendbyte; /* MSB of bytes */
size_t numsignificantbytes; /* number of bytes that matter */
@ -769,8 +770,7 @@ _PyLong_FromByteArray(const unsigned char* bytes, size_t n,
if (accumbits >= PyLong_SHIFT) {
/* There's enough to fill a Python digit. */
assert(idigit < ndigits);
v->ob_digit[idigit] = (digit)(accum &
PyLong_MASK);
v->ob_digit[idigit] = (digit)(accum & PyLong_MASK);
++idigit;
accum >>= PyLong_SHIFT;
accumbits -= PyLong_SHIFT;
@ -856,8 +856,7 @@ _PyLong_AsByteArray(PyLongObject* v,
/* Count # of sign bits -- they needn't be stored,
* although for signed conversion we need later to
* make sure at least one sign bit gets stored. */
digit s = do_twos_comp ? thisdigit ^ PyLong_MASK :
thisdigit;
digit s = do_twos_comp ? thisdigit ^ PyLong_MASK : thisdigit;
while (s != 0) {
s >>= 1;
accumbits++;
@ -917,7 +916,7 @@ _PyLong_AsByteArray(PyLongObject* v,
return 0;
Overflow:
Overflow:
PyErr_SetString(PyExc_OverflowError, "int too big to convert");
return -1;
@ -1172,8 +1171,7 @@ PyLong_AsLongLong(PyObject *vv)
case 0: return 0;
case 1: return v->ob_digit[0];
}
res = _PyLong_AsByteArray(
(PyLongObject *)vv, (unsigned char *)&bytes,
res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1);
/* 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];
}
res = _PyLong_AsByteArray(
(PyLongObject *)vv, (unsigned char *)&bytes,
res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0);
/* Plan 9 can't handle PY_LONG_LONG in ? : expressions */
@ -1998,8 +1995,8 @@ digit beyond the first.
twodigits convmax = base;
int i = 1;
log_base_BASE[base] = log((double)base) /
log((double)PyLong_BASE);
log_base_BASE[base] = (log((double)base) /
log((double)PyLong_BASE));
for (;;) {
twodigits next = convmax * base;
if (next > PyLong_BASE)
@ -2428,7 +2425,8 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e)
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. */
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.
*/
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;
Py_ssize_t size_lo, size_hi;
@ -3819,12 +3820,11 @@ long_rshift(PyLongObject *a, PyLongObject *b)
for (i = 0, j = wordshift; i < newsize; i++, j++) {
z->ob_digit[i] = (a->ob_digit[j] >> loshift) & lomask;
if (i+1 < newsize)
z->ob_digit[i] |=
(a->ob_digit[j+1] << hishift) & himask;
z->ob_digit[i] |= (a->ob_digit[j+1] << hishift) & himask;
}
z = long_normalize(z);
}
rshift_error:
rshift_error:
return (PyObject *) maybe_small_long(z);
}
@ -3874,7 +3874,7 @@ long_lshift(PyObject *v, PyObject *w)
else
assert(!accum);
z = long_normalize(z);
lshift_error:
lshift_error:
return (PyObject *) maybe_small_long(z);
}
@ -4371,7 +4371,7 @@ long_bit_length(PyLongObject *v)
return (PyObject *)result;
error:
error:
Py_DECREF(result);
return NULL;
}
@ -4633,19 +4633,19 @@ string, use the optional base. It is an error to supply a base when\n\
converting a non-string.");
static PyNumberMethods long_as_number = {
(binaryfunc) long_add, /*nb_add*/
(binaryfunc) long_sub, /*nb_subtract*/
(binaryfunc) long_mul, /*nb_multiply*/
(binaryfunc)long_add, /*nb_add*/
(binaryfunc)long_sub, /*nb_subtract*/
(binaryfunc)long_mul, /*nb_multiply*/
long_mod, /*nb_remainder*/
long_divmod, /*nb_divmod*/
long_pow, /*nb_power*/
(unaryfunc) long_neg, /*nb_negative*/
(unaryfunc) long_long, /*tp_positive*/
(unaryfunc) long_abs, /*tp_absolute*/
(inquiry) long_bool, /*tp_bool*/
(unaryfunc) long_invert, /*nb_invert*/
(unaryfunc)long_neg, /*nb_negative*/
(unaryfunc)long_long, /*tp_positive*/
(unaryfunc)long_abs, /*tp_absolute*/
(inquiry)long_bool, /*tp_bool*/
(unaryfunc)long_invert, /*nb_invert*/
long_lshift, /*nb_lshift*/
(binaryfunc) long_rshift, /*nb_rshift*/
(binaryfunc)long_rshift, /*nb_rshift*/
long_and, /*nb_and*/
long_xor, /*nb_xor*/
long_or, /*nb_or*/
@ -4722,8 +4722,7 @@ internal representation of integers. The attributes are read only.");
static PyStructSequence_Field int_info_fields[] = {
{"bits_per_digit", "size of a digit in bits"},
{"sizeof_digit", "size in bytes of the C type used to "
"represent a digit"},
{"sizeof_digit", "size in bytes of the C type used to represent a digit"},
{NULL, NULL}
};