[pypy-svn] r46720 - pypy/dist/pypy/translator/c

arigo at codespeak.net arigo at codespeak.net
Tue Sep 18 13:53:52 CEST 2007


Author: arigo
Date: Tue Sep 18 13:53:50 2007
New Revision: 46720

Modified:
   pypy/dist/pypy/translator/c/primitive.py
Log:
Special-case the minimum value of r_longlong in the same way
as we have to special-case the smallest 'int'.


Modified: pypy/dist/pypy/translator/c/primitive.py
==============================================================================
--- pypy/dist/pypy/translator/c/primitive.py	(original)
+++ pypy/dist/pypy/translator/c/primitive.py	Tue Sep 18 13:53:50 2007
@@ -1,6 +1,7 @@
 import sys
 from pypy.rlib.objectmodel import Symbolic, ComputedIntSymbolic
 from pypy.rlib.objectmodel import CDefinedIntSymbolic
+from pypy.rlib.rarithmetic import r_longlong
 from pypy.rpython.lltypesystem.lltype import *
 from pypy.rpython.lltypesystem import rffi
 from pypy.rpython.lltypesystem.llmemory import Address, \
@@ -70,7 +71,11 @@
     return '%dULL' % value
 
 def name_signedlonglong(value, db):
-    return '%dLL' % value
+    maxlonglong = r_longlong.MASK>>1
+    if value == -maxlonglong-1:    # blame C
+        return '(-%dLL-1LL)' % maxlonglong
+    else:
+        return '%dLL' % value
 
 def isinf(x):
     return x != 0.0 and x / 2 == x



More information about the Pypy-commit mailing list