#BUGFIX
authorClaus Gittinger <cg@exept.de>
Fri, 26 Feb 2016 19:28:16 +0100
changeset 19256 91884b166d88
parent 19255 0796978111de
child 19257 f1937ab25bbf
#BUGFIX class: LargeInteger changed: #absFastDivMod: fix for 32bit versions
LargeInteger.st
--- a/LargeInteger.st	Fri Feb 26 13:09:42 2016 +0100
+++ b/LargeInteger.st	Fri Feb 26 19:28:16 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1994 by Claus Gittinger
               All Rights Reserved
@@ -314,8 +316,6 @@
     "Modified: / 8.5.1998 / 21:40:41 / cg"
 ! !
 
-
-
 !LargeInteger class methodsFor:'queries'!
 
 isBuiltInClass
@@ -3182,6 +3182,13 @@
 
         index0 = index - 1;
 
+        // at least one byte of value must remain when dividing
+# if (__POINTER_SIZE__ == 8)
+        if (divisor > 0xFFFFFFFFFFFFFF) RETURN(nil);
+# else
+        if (divisor > 0xFFFFFF) RETURN(nil);
+# endif
+
 # if (__POINTER_SIZE__ == 8)
         if (sizeof(int) == 4) {
             /*
@@ -3270,7 +3277,7 @@
                 RETURN ( __ARRAY_WITH2(result, prevRest));
             }
             if ((index == sizeof(INT))
-            && resultBytes[index0] >= 0x40) {
+             && resultBytes[index0] >= 0x40) {
                 RETURN ( __ARRAY_WITH2(result, prevRest));
             }
         }
@@ -3298,6 +3305,8 @@
      ((666666666666666666 asLargeInteger absFastDivMod:16r3))
      ((1666666666 asLargeInteger absFastDivMod:16r3))
     "
+
+    "Modified: / 26-02-2016 / 19:27:13 / cg"
 !
 
 absFastMinus:aSmallInteger sign:newSign