diff --git a/stdlib/utils.sol b/stdlib/utils.sol new file mode 100644 index 000000000000..b854f183e972 --- /dev/null +++ b/stdlib/utils.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 + +function min(T a, T b) pure internal returns (T ret) { + ret = (a < b) ? a : b; +} + +function max(T a, T b) pure internal returns (T ret) { + ret = (a > b) ? a : b; +} + +function abs(T a) pure internal returns (T ret) { + ret = (a < 0) ? -a : a; +}