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:
committed by
Francisco Giordano
parent
41e6b2e992
commit
9aa30e1960
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user