Skip to content

Commit

Permalink
docs(slice): Clarify half-open interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian committed Dec 20, 2017
1 parent 588f7db commit f6ab79d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libcore/slice/mod.rs
Expand Up @@ -400,7 +400,7 @@ impl<T> SliceExt for [T] {
while size > 1 {
let half = size / 2;
let mid = base + half;
// mid is always in [0, size).
// mid is always in [0, size), that means mid is >= 0 and < size.
// mid >= 0: by definition
// mid < size: mid = size / 2 + size / 4 + size / 8 ...
let cmp = f(unsafe { s.get_unchecked(mid) });
Expand Down

0 comments on commit f6ab79d

Please sign in to comment.