We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fda8e15 commit b909364Copy full SHA for b909364
src/libcore/slice/sort.rs
@@ -527,7 +527,9 @@ fn break_patterns<T>(v: &mut [T]) {
527
// we first take it modulo a power of two, and then decrease by `len` until it fits
528
// into the range `[0, len - 1]`.
529
let mut other = gen_usize() & (modulus - 1);
530
- while other >= len {
+
531
+ // `other` is guaranteed to be less than `2 * len`.
532
+ if other >= len {
533
other -= len;
534
}
535
0 commit comments