mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-05-06 19:47:55 +00:00
6af889c1ff
Signed-off-by: xermicus <cyrill@parity.io>
26 lines
538 B
Solidity
26 lines
538 B
Solidity
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)
|
|
}
|
|
}
|
|
}
|