Skip to content

Commit 596fd35

Browse files
joboetyotamofekhanna-kruppe
authored
core: improve comments
Co-authored-by: Yotam Ofek <[email protected]> Co-authored-by: Hanna Kruppe <[email protected]>
1 parent e7f87ce commit 596fd35

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/bool.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ impl bool {
6262
}
6363

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

0 commit comments

Comments
 (0)