```\nfunction _scaleAmountByPercentage(uint256 amount, uint256 scaledPercent)\n  internal\n  pure\n  returns (uint256 scaledAmount)\n{\n  // use assembly to bypass checking for overflow & division by 0\n  // scaledPercent has been validated to be < PERCENTAGE_SCALE)\n  // & PERCENTAGE_SCALE will never be 0\n  // pernicious ERC20s may cause overflow, but results do not affect ETH & other ERC20 balances\n  assembly {\n    /* eg (100 * 2*1e4) / (1e6) */\n    scaledAmount := div(mul(amount, scaledPercent), PERCENTAGE_SCALE)\n  }\n}\n```\n