https://issues.dlang.org/show_bug.cgi?id=13963

--- Comment #4 from mfx <[email protected]> ---
This patch seems to fix the issue for me. The unittest will still have to get
updated.

--- dmd-phobos.git/std/bigint.d 2015-01-25 06:45:36.000000000 +0100
+++ bigint.d    2015-01-25 10:34:57.000000000 +0100
@@ -157,6 +157,8 @@
             }
             // x%y always has the same sign as x.
             // This is not the same as mathematical mod.
+            if (data.isZero())
+                sign = false;
         }
         else static if (op==">>" || op=="<<")
         {
@@ -279,6 +281,14 @@
                 return r;
             }
         }
+        else static if (is(Unqual!T == uint))
+        {
+            uint u = absUnsign(y);
+            long rem = BigUint.modInt(data, u);
+            // x%y always has the same sign as x.
+            // This is not the same as mathematical mod.
+            return sign ? -rem : rem;
+        }
         else
         {
             uint u = absUnsign(y);

--

Reply via email to