Skip to content

Commit

Permalink
core: improve comments
Browse files Browse the repository at this point in the history
Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com>
Co-authored-by: Hanna Kruppe <hanna.kruppe@gmail.com>
  • Loading branch information
3 people authored and gitbot committed Feb 20, 2025
1 parent 97f1eb8 commit 1d1e5c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ impl bool {
}

/// Returns either `true_val` or `false_val` depending on the value of
/// `condition`, with a hint to the compiler that `condition` is unlikely
/// `self`, with a hint to the compiler that `self` is unlikely
/// to be correctly predicted by a CPU’s branch predictor.
///
/// This method is functionally equivalent to writing
/// This method is functionally equivalent to
/// ```ignore (this is just for illustrative purposes)
/// if b { true_val } else { false_val }
/// fn select_unpredictable<T>(b: bool, true_val: T, false_val: T) -> T {
/// if b { true_val } else { false_val }
/// }
/// ```
/// but might generate different assembly. In particular, on platforms with
/// a conditional move or select instruction (like `cmov` on x86 or `csel`
Expand Down

0 comments on commit 1d1e5c2

Please sign in to comment.