return (n + d - 1) / d;
}
+template<typename T, typename U>
+constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> round_down_to(T n, U d) {
+ return n - n % d;
+}
template<typename T, typename U>
constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> round_up_to(T n, U d) {
uint64_t left = m_length;
while (left > 0) {
- uint64_t period_off = off - (off % period);
+ uint64_t period_off = round_down_to(off, period);
uint64_t read_len = std::min(period_off + period - off, left);
if (fast_diff_enabled) {