Skip to content

Commit 50aada7

Browse files
committed
Auto merge of #25159 - inrustwetrust:wrapping_inline, r=alexcrichton
This was causing function calls to be emitted for bitwise complements, even with optimizations on. Steps to reproduce: ``` $ cat wrapping.rs fn main() { let a = std::num::Wrapping(std::env::args().len() as u32); let b = !a; println!("{}", b.0); } $ rustc -O wrapping.rs --emit=asm,link $ grep Not wrapping.s callq _ZN3num8wrapping23Wrapping$LT$u32$GT$.Not3not20hba4b266232e02b1dHkbE ```
2 parents 8c9dc18 + 48636f3 commit 50aada7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libcore/num/wrapping.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ macro_rules! wrapping_impl {
123123
impl Not for Wrapping<$t> {
124124
type Output = Wrapping<$t>;
125125

126+
#[inline(always)]
126127
fn not(self) -> Wrapping<$t> {
127128
Wrapping(!self.0)
128129
}

0 commit comments

Comments
 (0)