Fix overflow in tone module loop count calculation.