Add Modulo operation for getting the quotient (#915)

* Add Modulo operation for getting the quotient

* Improved modulo tests and implementation.

* Removed assertion.
This commit is contained in:
jeano
2018-08-14 05:40:48 +09:00
committed by Francisco Giordano
parent 41e6b2e992
commit 9aa30e1960
3 changed files with 53 additions and 0 deletions

View File

@ -54,4 +54,13 @@ library SafeMath {
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}