Open
Description
What it does
See title.
Similar for x.is_multiple_of(y)
and x % y == 0
.
Advantage
More readable and overflow checks
Drawbacks
No response
Example
let x = ((x + 3) / 4) * 4;
let y = (y + 3) & !3;
let z = z % 4 == 0;
Could be written as:
let x = x.next_multiple_of(4);
let y = y.next_multiple_of(4);
let z = z.is_multiple_of(4);