Skip to content

libm: implement accelerated computation of (x << e) % y #1012

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

quaternic
Copy link
Contributor

@quaternic quaternic commented Aug 12, 2025

Builds on #1011, both were split from #1002

The computation is implemented in linear_mul_reduction.

Comment on lines +301 to +304
+ core::ops::Add<Output = Self>
+ core::ops::Sub<Output = Self>
+ core::ops::Shl<u32, Output = Self>
+ core::ops::Shr<u32, Output = Self>
Copy link
Contributor

Choose a reason for hiding this comment

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

core::ops -> ops since it's already in scope

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this commit should be able to allow the #[allow(dead_code)] on NarrowingDiv

Comment on lines +1 to +2
use crate::support::int_traits::NarrowingDiv;
use crate::support::{DInt, HInt, Int};
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a module-level doc comment with some of the common names used here? E.g. R, RR (if that's not R*R) r, m, q, xq. I'm unfortunately a bit lost :) (but I don't need to understand it in detail)

Copy link
Contributor

Choose a reason for hiding this comment

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

If you've authored this, add /* SPDX-License-Identifier: MIT OR Apache-2.0 */ as well (or only MIT if it's derived, as appropriate)

}

#[cfg(test)]
mod test {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this spot check another integer size as well? Just using constants

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.

2 participants