Skip to content

Commit

Permalink
limb: always inline bitand
Browse files Browse the repository at this point in the history
Previously, rustc didn't inline `Limb::bitand` inside functions
such as `UInt::add_mod` and `UInt::sub_mod`, when calling them from
a different crate. This is probably because non-generic functions
don't get inlined across crates (unless using link-time
optimization).
  • Loading branch information
haslersn committed Aug 8, 2022
1 parent 817839d commit cf5b5d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/limb/bit_and.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use core::ops::BitAnd;

impl Limb {
/// Calculates `a & b`.
#[inline(always)]
pub const fn bitand(self, rhs: Self) -> Self {
Limb(self.0 & rhs.0)
}
Expand All @@ -13,6 +14,7 @@ impl Limb {
impl BitAnd for Limb {
type Output = Limb;

#[inline(always)]
fn bitand(self, rhs: Self) -> Self::Output {
self.bitand(rhs)
}
Expand Down

0 comments on commit cf5b5d6

Please sign in to comment.