diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-19 17:06:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-19 17:06:49 +0200 |
| commit | 355cdd3bc1571146366dfb8b0ce696b3b55f2f8c (patch) | |
| tree | 522a70c4ca5f86ef593a2de601d7acbc16ad7e16 /compiler/rustc_pattern_analysis/src/errors.rs | |
| parent | 45e4e963854873ca09d93bb5d0c14c8d76fa2e2f (diff) | |
| parent | 90bba8beb5cba6cbd0ff0fc92ed0a8b8ef537f8c (diff) | |
| download | rust-355cdd3bc1571146366dfb8b0ce696b3b55f2f8c.tar.gz rust-355cdd3bc1571146366dfb8b0ce696b3b55f2f8c.zip | |
Rollup merge of #126199 - ivan-shrimp:nonzero_isqrt, r=tgross35
Add `isqrt` to `NonZero<uN>`
Implements [#70887 (comment)](https://github.com/rust-lang/rust/issues/116226#issuecomment-2144225174), with the following signature:
```rust
impl NonZero<uN> {
const fn isqrt(self) -> Self;
}
```
Unintended benefits include one fewer panicking branch in `ilog2` for LLVM to optimize away, and one fewer `assume_unchecked` as `NonZero` already does that.
The fast path for `self == 1` is dropped, but the current implementation is very slow anyways compared to hardware. Performance improvements can always come later.
(I didn't add the function to `NonZero<iN>`, since _every_ existing `NonZero` method is non-panicking, and it might be nice to leave it that way.)
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
