Skip to content

Commit

Permalink
Fix issue 7973 BigInt %= long/ulong gives wrong value
Browse files Browse the repository at this point in the history
Previous fix only worked for const; this fixes immutable too.
  • Loading branch information
don-clugston-sociomantic committed Jul 11, 2012
1 parent 7182ed4 commit 5e7b333
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion std/bigint.d
Expand Up @@ -162,7 +162,7 @@ public:
else static if (op=="%")
{
assert(y!=0, "Division by zero");
static if (is(const(T) == const(long)) || is( const(T) == const(ulong) ))
static if (is(immutable(T) == immutable(long)) || is( immutable(T) == immutable(ulong) ))
{
this %= BigInt(y);
}
Expand Down Expand Up @@ -581,11 +581,14 @@ unittest // Recursive division, bug 5568
// Bug 7973
auto a7973 = 10_000_000_000_000_000;
const c7973 = 10_000_000_000_000_000;
immutable c7973 = 10_000_000_000_000_000;
BigInt v7973 = 2551700137;
v7973 %= a7973;
assert(v7973 == 2551700137);
v7973 %= c7973;
assert(v7973 == 2551700137);
v7973 %= i7973;
assert(v7973 == 2551700137);
// 8165
BigInt[2] a8165;
a8165[0] = a8165[1] = 1;
Expand Down

0 comments on commit 5e7b333

Please sign in to comment.