mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 19:38:01 +00:00
83bf9d6041
Signed-off-by: xermicus <cyrill@parity.io>
30 lines
594 B
Solidity
30 lines
594 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8;
|
|
|
|
contract DivisionArithmetics {
|
|
function div(uint n, uint d) public pure returns (uint q) {
|
|
assembly {
|
|
q := div(n, d)
|
|
}
|
|
}
|
|
|
|
function sdiv(int n, int d) public pure returns (int q) {
|
|
assembly {
|
|
q := sdiv(n, d)
|
|
}
|
|
}
|
|
|
|
function mod(uint n, uint d) public pure returns (uint r) {
|
|
assembly {
|
|
r := mod(n, d)
|
|
}
|
|
}
|
|
|
|
function smod(int n, int d) public pure returns (int r) {
|
|
assembly {
|
|
r := smod(n, d)
|
|
}
|
|
}
|
|
}
|