I'd like to divide integers of different sizes (uint16 and uint256). Do I need to cast the integers to the same size prior to the divide? Or can I just do the the following safely:
import "../math/SafeMath.sol";
using SafeMath for uint256;
using SafeMath for uint16;
uint16 public totalValid;
uint256 public etherValue;
function _calculatePayout() internal{
require(this.balance > 0);
etherValue = this.balance.div(totalValid); // uint256 this.balance
}
Thoughts appreciated.
this.balance / totalValid
, sinceSafeMath.div
function is pointless (there's no such thing as "safe div"), and OpenZeppelin will probably realize this sooner or later...