binary GCD algorithm