Commit 4b133a7
committed
Auto merge of rust-lang#94517 - aDotInTheVoid:inline_wrapping_next_power_two, r=yaahc
Mark `uint::wrapping_next_power_of_two` as `#[inline]`
This brings it in line with `next_power_of_two` and `checked_next_power_of_two`
https://godbolt.org/z/Tr18GnqKj
<details>
<summary> Output as of `rustc 1.61.0-nightly (4ce3749 2022-02-28)` </summary>
```asm
example::npot:
lea eax, [rdi - 1]
movzx eax, al
lzcnt ecx, eax
add ecx, -24
mov al, -1
shr al, cl
inc al
cmp dil, 2
movzx ecx, al
mov eax, 1
cmovae eax, ecx
ret
example::cnpot:
lea eax, [rdi - 1]
movzx eax, al
lzcnt ecx, eax
add ecx, -24
mov al, -1
shr al, cl
xor ecx, ecx
cmp dil, 2
movzx edx, al
cmovb edx, ecx
inc dl
setne al
ret
example::wrapping_next_power_of_two:
jmp qword ptr [rip + _ZN4core3num20_$LT$impl$u20$u8$GT$26wrapping_next_power_of_two17hd879a85055735264E@GOTPCREL]
```
</details>1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2226 | 2226 | | |
2227 | 2227 | | |
2228 | 2228 | | |
| 2229 | + | |
2229 | 2230 | | |
2230 | 2231 | | |
2231 | 2232 | | |
| |||
0 commit comments