23 lines
535 B
Solidity
23 lines
535 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
/**
|
|
* @author Matter Labs
|
|
* @custom:security-contact security@matterlabs.dev
|
|
* @notice The library for unchecked math.
|
|
*/
|
|
library UncheckedMath {
|
|
function uncheckedInc(uint256 _number) internal pure returns (uint256) {
|
|
unchecked {
|
|
return _number + 1;
|
|
}
|
|
}
|
|
|
|
function uncheckedAdd(uint256 _lhs, uint256 _rhs) internal pure returns (uint256) {
|
|
unchecked {
|
|
return _lhs + _rhs;
|
|
}
|
|
}
|
|
}
|