added doc
This commit is contained in:
parent
22fab08702
commit
eea55fa02d
1 changed files with 4 additions and 3 deletions
|
@ -226,8 +226,9 @@ impl<'g> Displacement<'g> {
|
|||
}
|
||||
}
|
||||
|
||||
fn would_overflow(n: usize, d: isize, max: usize) -> bool {
|
||||
let too_little = n == 0 && d == -1;
|
||||
let too_big = n == max && d == 1;
|
||||
/// determine if the given number, added a delta that is either 1 or -1 to it would overflow a certain maximum value for n
|
||||
fn would_overflow(number: usize, delta: isize, max: usize) -> bool {
|
||||
let too_little = number == 0 && delta == -1;
|
||||
let too_big = number == max && delta == 1;
|
||||
too_little || too_big
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue