Annotate std/bigint.d and std/internal/math/biguintcore.d to please d…#8081
Annotate std/bigint.d and std/internal/math/biguintcore.d to please d…#8081WalterBright merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @nordlow! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8081" |
std/bigint.d
Outdated
| { | ||
| BigInt r = this; | ||
| return r.opOpAssign!(op)(y); | ||
| r.opOpAssign!(op)(y); |
There was a problem hiding this comment.
I'm gonna see if I can get this to build without this change.
|
Is static void divMod(scope return BigUint x, scope BigUint y,
scope out BigUint quotient, scope out BigUint remainder) pure nothrow @safe
{
if (y.data.length > x.data.length)
{
quotient = 0uL;
remainder = x;
}
else if (y.data.length == 1)
{
quotient = divInt(x, y.data[0]);
remainder = BigUint([modInt(x, y.data[0])]);
}
else
{
BigDigit[] quot = new BigDigit[x.data.length - y.data.length + 1];
BigDigit[] rem = new BigDigit[y.data.length];
divModInternal(quot, rem, x.data, y.data);
quotient = BigUint(removeLeadingZeros(trustedAssumeUnique(quot)));
remainder = BigUint(removeLeadingZeros(trustedAssumeUnique(rem)));
}
}the correct parameter qualification of I'm asking because I can't find any references on assigning |
|
As far as I understand: |
Ok, thanks. Adjusted to static void divMod(scope BigUint x, scope BigUint y,
out BigUint quotient, out BigUint remainder) pure nothrow @safebut that fails as Qualifying What to do, @WalterBright @thewilsonator ? |
1171b2c to
0397698
Compare
|
Why does // biguintcore.d(977):
remainder = BigUint(x.data.idup);
// biguintcore.d(981):
quotient = divInt(BigUint(x.data.idup), y.data[0]);If you do that, maybe add a comment that the redundant allocation is due to the limitation that |
I'm surprised this limitation hasn't been brought up. Has |
0397698 to
5e12829
Compare
Thanks for highlighting this. I've reverted to that doesn't require any @trusted and that passes locally with dmd master my machine. Parameter I also made
So no more
Made title non-WIP. Ready now, @RazvanN7 and @thewilsonator. |
5e12829 to
b699ca9
Compare
b699ca9 to
a44f718
Compare
…lang/dmd#12520
Part of #8076