Matthias Krüger
6fb00b1514
Rollup merge of #143477 - folkertdev:use-is-multiple-of, r=joshtriplett
...
use `is_multiple_of` and `div_ceil`
In tricky logic, these functions are much more informative than the manual implementations. They also catch subtle bugs:
- the manual `is_multiple_of` often does not handle division by zero
- manual `div_ceil` often does not consider overflow
The transformation is free for `is_multiple_of` if the divisor is compile-time known to be non-zero. For `div_ceil` there is a small cost to considering overflow. Here is some assembly https://godbolt.org/z/5zP8KaE1d .
2025-07-06 10:03:23 +02:00
..
2025-07-05 10:55:42 +02:00
2025-07-05 12:37:17 +00:00
2025-07-04 05:47:27 +02:00
2025-07-04 05:47:27 +02:00
2025-07-01 19:00:21 +00:00
2025-07-05 21:23:09 +02:00
2025-07-05 21:23:09 +02:00
2025-07-06 10:03:23 +02:00
2025-07-04 05:47:27 +02:00
2025-07-03 10:52:21 -07:00
2025-07-03 10:52:21 -07:00
2025-07-05 10:55:42 +02:00
2025-07-05 15:53:56 +02:00
2025-07-06 10:03:23 +02:00
2025-07-05 00:12:10 +02:00
2025-06-30 20:49:40 +02:00
2025-07-04 16:22:37 +02:00
2025-07-05 16:23:13 -07:00
2025-07-02 17:18:47 +00:00
2025-07-05 21:23:09 +02:00
2025-07-05 15:24:15 +00:00
2025-07-01 19:00:21 +00:00
2025-07-04 05:47:28 +02:00
2025-07-05 10:55:42 +02:00
2025-07-04 18:26:09 +00:00
2025-07-04 14:02:17 +00:00
2025-07-03 10:51:06 +03:00
2025-07-05 18:37:11 +00:00
2025-07-03 10:51:06 +03:00
2025-07-03 13:29:35 +02:00
2025-07-04 14:02:18 +00:00
2025-07-05 15:24:15 +00:00
2025-07-05 15:24:15 +00:00
2025-07-03 23:17:03 +00:00
2025-07-03 10:51:06 +03:00
2025-07-05 18:41:59 +00:00
2025-07-05 21:23:09 +02:00
2025-07-06 10:03:23 +02:00
2025-07-04 01:28:35 -07:00
2025-07-04 14:02:17 +00:00
2025-07-05 10:55:35 +02:00
2025-07-05 16:23:13 -07:00
2025-07-01 19:00:21 +00:00
2025-07-05 10:55:42 +02:00
2025-07-04 16:22:37 +02:00
2025-07-04 18:26:09 +00:00
2025-07-05 10:55:42 +02:00
2025-07-01 19:00:21 +00:00
2025-07-05 10:55:42 +02:00
2025-07-04 18:26:09 +00:00
2025-07-02 00:33:06 +00:00
2025-07-05 10:55:35 +02:00
2025-07-03 10:51:06 +03:00