Implement `unbounded_shl`/`unbounded_shr`
まだ誰も着手していません。
評価
調査の方向性
まず、Rust の整数メソッドの lowering と、OpShiftLeftLogical および OpShiftRightLogical を出力するコードパスを特定します。unbounded_shl と unbounded_shr が、整数の幅以上のシフト量を含め、これらの命令を直接使用していることを確認し、それらのケースのカバレッジを追加または更新します。
索引モデルが issue の本文から書いたものです。
説明
These recent Rust integer methods semantically map cleanly onto OpShiftLeftLogical/OpShiftRightLogical.
This is in contrast to normal Rust shifts, whose semantic is such that shifting by the amount that is equal to or larger than number of bits in an integer is UB:
error: this arithmetic operation will overflow
--> src/main.rs:3:20
|
3 | println!("{}", u32::MAX >> 32);
| ^^^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow
|
= note: `#[deny(arithmetic_overflow)]` on by default
My understanding is that rust-gpu doesn't map these methods to those instructions yet, probably resulting in use of conditional logic from standard library, which is less efficient, at least without additional optimizations:
impl u32 {
pub const fn unbounded_shr(self, rhs: u32) -> u32 {
if rhs < Self::BITS {
unsafe { self.unchecked_shr(rhs) }
} else {
0
}
}
}
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 126
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Rust-GPU/rust-gpu のほかの issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
enhancement
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Rust-GPU/rust-gpu の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
stratum-mining/stratum#2404 ·
-
bug ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100