text: public static long Gcd(long a, long b){a = a < 0 ? -a : a;b = b < 0 ? -b : b;if (a == 0){return b;}else if (b == 0){return a;}int commonTrailingZeros = (a | b).TrailingZeroCount();a = (long)((ulong)a >> a.TrailingZeroCount());while (true){b = (long)((ulong)b >> b.TrailingZeroCount());if (a == b){break;} else if (a > b || a == long.MinValue){long tmp = a;a = b;b = tmp;}if (a == 1){break;}b -= a;}return a << commonTrailingZeros;}