summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-09 03:58:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-09 03:58:09 (GMT)
commit3563153793623f693b8cd5697cd8a2ae6094d240 (patch)
treeb29d9a22814ee220f28ddbc9a21ed895ae37bfbc /Objects/longobject.c
parent1467ac8e5430b9f3a193a70b6dcd77d56a2e56f1 (diff)
downloadcpython-3563153793623f693b8cd5697cd8a2ae6094d240.zip
cpython-3563153793623f693b8cd5697cd8a2ae6094d240.tar.gz
cpython-3563153793623f693b8cd5697cd8a2ae6094d240.tar.bz2
Reduce the size of the _PyLong_DigitValue table.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 362d0ad..9993d10 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1646,7 +1646,7 @@ _PyLong_Format(PyObject *aa, int base)
* Note that when converting a base B string, a char c is a legitimate
* base B digit iff _PyLong_DigitValue[Py_CHARPyLong_MASK(c)] < B.
*/
-int _PyLong_DigitValue[256] = {
+unsigned char _PyLong_DigitValue[256] = {
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
@@ -1710,7 +1710,7 @@ long_from_binary_base(char **str, int base)
bits_in_accum = 0;
pdigit = z->ob_digit;
while (--p >= start) {
- int k = _PyLong_DigitValue[Py_CHARMASK(*p)];
+ int k = (int)_PyLong_DigitValue[Py_CHARMASK(*p)];
assert(k >= 0 && k < base);
accum |= (twodigits)(k << bits_in_accum);
bits_in_accum += bits_per_char;
@@ -1926,7 +1926,7 @@ digit beyond the first.
c = (digit)_PyLong_DigitValue[Py_CHARMASK(*str++)];
for (i = 1; i < convwidth && str != scan; ++i, ++str) {
c = (twodigits)(c * base +
- _PyLong_DigitValue[Py_CHARMASK(*str)]);
+ (int)_PyLong_DigitValue[Py_CHARMASK(*str)]);
assert(c < PyLong_BASE);
}