summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-09 22:14:42 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-09 22:14:42 (GMT)
commit28746aba9bf636d03eb1c1c5f4550c6f2dbf5300 (patch)
tree02216272cf2d2e22496856213f9efe6e8996ce6b /Python
parent6ec6ab02c33b1b879fef7058bcfecd4edaa66bd9 (diff)
downloadcpython-28746aba9bf636d03eb1c1c5f4550c6f2dbf5300.zip
cpython-28746aba9bf636d03eb1c1c5f4550c6f2dbf5300.tar.gz
cpython-28746aba9bf636d03eb1c1c5f4550c6f2dbf5300.tar.bz2
On 64 bit systems, int literals that use less than 64 bits are now ints
rather than longs. This also fixes the test for eval(-sys.maxint - 1).
Diffstat (limited to 'Python')
-rw-r--r--Python/mystrtoul.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 1fc360b..51553fb 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -69,11 +69,22 @@ static unsigned long smallmax[] = {
* calculated by [int(math.floor(math.log(2**32, i))) for i in range(2, 37)].
* Note that this is pessimistic if sizeof(long) > 4.
*/
+#if SIZEOF_LONG == 4
static int digitlimit[] = {
0, 0, 32, 20, 16, 13, 12, 11, 10, 10, /* 0 - 9 */
9, 9, 8, 8, 8, 8, 8, 7, 7, 7, /* 10 - 19 */
7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 20 - 29 */
6, 6, 6, 6, 6, 6, 6}; /* 30 - 36 */
+#elif SIZEOF_LONG == 8
+/* [int(math.floor(math.log(2**64, i))) for i in range(2, 37)] */
+static int digitlimit[] = {
+ 0, 0, 64, 40, 32, 27, 24, 22, 21, 20, /* 0 - 9 */
+ 19, 18, 17, 17, 16, 16, 16, 15, 15, 15, /* 10 - 19 */
+ 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, /* 20 - 29 */
+ 13, 12, 12, 12, 12, 12, 12}; /* 30 - 36 */
+#else
+#error "Need table for SIZEOF_LONG"
+#endif
/*
** strtoul