Skip to content

Commit 7e1621f

Browse files
joboetyotamofekhanna-kruppe
authored and
gitbot
committed
core: improve comments
Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com> Co-authored-by: Hanna Kruppe <hanna.kruppe@gmail.com>
1 parent 49696ed commit 7e1621f

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
@@ -63,12 +63,14 @@ impl bool {
6363
}
6464

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

0 commit comments

Comments
 (0)