[Python-checkins] cpython: Support mythical ones' complement machines.

stefan.krah python-checkins at python.org
Wed Apr 18 19:02:18 CEST 2012


http://hg.python.org/cpython/rev/251c1a854f2f
changeset:   76399:251c1a854f2f
user:        Stefan Krah <skrah at bytereef.org>
date:        Wed Apr 18 17:57:56 2012 +0200
summary:
  Support mythical ones' complement machines.

files:
  Modules/_decimal/libmpdec/mpdecimal.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c
--- a/Modules/_decimal/libmpdec/mpdecimal.c
+++ b/Modules/_decimal/libmpdec/mpdecimal.c
@@ -1340,7 +1340,7 @@
     if (u <= MPD_SSIZE_MAX) {
         return isneg ? -((mpd_ssize_t)u) : (mpd_ssize_t)u;
     }
-    else if (isneg && u-1 == MPD_SSIZE_MAX) {
+    else if (isneg && u+(MPD_SSIZE_MIN+MPD_SSIZE_MAX) == MPD_SSIZE_MAX) {
         return MPD_SSIZE_MIN;
     }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list