i*divisor might overflow 32bits.  You need to cast one/all of them as well.