Zynga game services need a lightweight integer division routine for environments where arithmetic division is unavailable. Implement divide(dividend, divisor) without using division, multiplication, modulo, or exponentiation operators.
Return the integer quotient truncated toward zero. The result must fit in the signed 32-bit range. If the mathematical quotient exceeds that range, clamp it to 2^31 - 1 or -2^31 as appropriate.
dividend and nonzero divisor.dividend / divisor, truncated toward zero and clamped to the signed 32-bit range./, //, %, *, or exponentiation.def divide(dividend, divisor):