Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Commit 38f06e7

Browse files
committed
Add a ceilDiv function.
1 parent d1924bb commit 38f06e7

File tree

1 file changed

+6
-0
lines changed
  • dang-utils/include/dang-utils

1 file changed

+6
-0
lines changed

dang-utils/include/dang-utils/utils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,10 @@ template <typename T>
398398
return value * value;
399399
}
400400

401+
template <typename T>
402+
[[nodiscard]] constexpr auto ceilDiv(T numerator, T denominator)
403+
{
404+
return (numerator + denominator - 1) / denominator;
405+
}
406+
401407
} // namespace dang::utils

0 commit comments

Comments
 (0)