Calculates the greatest common divisor of a given int