Skip to content

Commit

Permalink
libcore: sort_unstable: remove unnecessary loop.
Browse files Browse the repository at this point in the history
`other` is guaranteed to be less than `2 * len`.
  • Loading branch information
vadzimdambrouski committed Mar 28, 2017
1 parent fda8e15 commit b909364
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libcore/slice/sort.rs
Expand Up @@ -527,7 +527,9 @@ fn break_patterns<T>(v: &mut [T]) {
// we first take it modulo a power of two, and then decrease by `len` until it fits
// into the range `[0, len - 1]`.
let mut other = gen_usize() & (modulus - 1);
while other >= len {

// `other` is guaranteed to be less than `2 * len`.
if other >= len {
other -= len;
}

Expand Down

0 comments on commit b909364

Please sign in to comment.