added doc

This commit is contained in:
JOLIMAITRE Matthieu 2022-04-04 15:12:27 +03:00
parent 22fab08702
commit eea55fa02d

View file

@ -226,8 +226,9 @@ impl<'g> Displacement<'g> {
} }
} }
fn would_overflow(n: usize, d: isize, max: usize) -> bool { /// determine if the given number, added a delta that is either 1 or -1 to it would overflow a certain maximum value for n
let too_little = n == 0 && d == -1; fn would_overflow(number: usize, delta: isize, max: usize) -> bool {
let too_big = n == max && d == 1; let too_little = number == 0 && delta == -1;
let too_big = number == max && delta == 1;
too_little || too_big too_little || too_big
} }