feat(libraries): add fixed-point and low-level math primitives

This commit is contained in:
dualfroz committed 2026-08-23 11:44:00 +02:00
1 parent 3f335c47ec
commit d83d3c1e96
4 files changed
+48

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.36;
/// @title Rounding-up integer division that trusts its non-zero denominator.
library UnsafeMath {
function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
assembly {
z := add(div(x, y), gt(mod(x, y), 0))
}
}
}