Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 16264(+11599) - BigInt multiplication crashes on 64-bit #5715

Merged
merged 1 commit into from
Oct 28, 2017

Conversation

yosupo06
Copy link
Contributor

@yosupo06 yosupo06 commented Aug 31, 2017

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @yosupo06! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
16264 BigInt multiplication crashes on 64-bit (biguintnoasm.d(276): Range violation)

@MartinNowak
Copy link
Member

Thanks for your fix and thorough testing.
A small explanation of what you fixed (in the commit message) would be really helpful to review this.

mulKaratsuba(result[0 .. half + y.length], y, x[0 .. half], scratchbuff);
partial[] = result[half .. half + y.length];
mulKaratsuba(result[half .. $], y, x[half .. $], scratchbuff);
addAssignSimple(result[half .. half + y.length], partial);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks structurally very similar to the variant below, any chance this could be integrated there?

paddingY = true;
assert(chunksize + extra + chunksize *(numchunks-1) == x.length );
bool isExtraSmall = extra * extra * 2 < y.length * y.length;
if (numchunks == 1 && isExtraSmall)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment what this condition means?

@MartinNowak
Copy link
Member

thx

@MartinNowak MartinNowak merged commit 18c19d8 into dlang:stable Oct 28, 2017
@CyberShadow
Copy link
Member

This pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=19740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants