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

Add initial implementation for Karatsuba multiplication #24

Merged
merged 2 commits into from
Mar 3, 2024
Merged

Conversation

OTheDev
Copy link
Owner

@OTheDev OTheDev commented Mar 2, 2024

No description provided.

@OTheDev OTheDev self-assigned this Mar 2, 2024
@@ -468,17 +541,12 @@ void h_::mul(bi_t& result, const bi_t& a, const bi_t& b) {
const size_t m = a.size();
const size_t n = b.size();

const auto [n_result_digits, overflow] = uints::uadd_overflow(m, n);
Copy link
Owner Author

Choose a reason for hiding this comment

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

By the constraints imposed by this library (namely, that max_digits is less than or equal to SIZE_MAX / sizeof(digit), this summation will never overflow.

@OTheDev OTheDev merged commit 3e055df into main Mar 3, 2024
8 checks passed
@OTheDev OTheDev deleted the kara branch March 3, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant