diff options
| author | Vadzim Dambrouski <vadzim.dambrouski@promwad.com> | 2017-03-28 17:43:01 +0300 |
|---|---|---|
| committer | Vadzim Dambrouski <vadzim.dambrouski@promwad.com> | 2017-03-28 17:43:01 +0300 |
| commit | b90936449b161f4aee5ff81bbb4906bf5a27f181 (patch) | |
| tree | c8cce04e1e38ce2507d14bb750d2d16415be9940 /src/libcore/slice | |
| parent | fda8e1571f7a0c4da77c57bc7a7728c4ed1e6aea (diff) | |
| download | rust-b90936449b161f4aee5ff81bbb4906bf5a27f181.tar.gz rust-b90936449b161f4aee5ff81bbb4906bf5a27f181.zip | |
libcore: sort_unstable: remove unnecessary loop.
`other` is guaranteed to be less than `2 * len`.
Diffstat (limited to 'src/libcore/slice')
| -rw-r--r-- | src/libcore/slice/sort.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/slice/sort.rs b/src/libcore/slice/sort.rs index 3612ee65bca..7065fdb79fc 100644 --- a/src/libcore/slice/sort.rs +++ b/src/libcore/slice/sort.rs @@ -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; } |
