Suggest using next_multiple_of()
instead of ((x + N-1) / N) * N
or (x + N-1) & !(N-1)
(for powers of two)
#14543
Labels
A-lint
Area: New lints
What it does
See title.
Similar for
x.is_multiple_of(y)
andx % y == 0
.Advantage
More readable and overflow checks
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: