Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions std/internal/math/biguintcore.d
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,16 @@ else alias multibyteSquare = std.internal.math.biguintnoasm.multibyteSquare;
// Half the size of the data cache.
@nogc nothrow pure @safe size_t getCacheLimit()
{
import core.cpuid : dataCaches;
return dataCaches[0].size * 1024 / 2;
if (__ctfe)
{
// Chosen arbitrarily.
return 8192;
}
else
{
import core.cpuid : dataCaches;
return dataCaches[0].size * 1024 / 2;
}
}
enum size_t FASTDIVLIMIT = 100; // crossover to recursive division

Expand Down Expand Up @@ -1267,6 +1275,12 @@ public:
assert(BigUint.mulInt(a,b) == 15);
}

// https://github.com/dlang/phobos/issues/11047
@safe pure nothrow unittest
{
enum ctfeLargeMultiplication = BigUint.mul(BigUint(ulong(1)) << ulong(33), BigUint(ulong(1)) << ulong(32));
}

// Remove leading zeros from x, to restore the BigUint invariant
inout(BigDigit) [] removeLeadingZeros(return scope inout(BigDigit) [] x) pure nothrow @safe
{
Expand Down
Loading