Binary GCD computes a greatest common divisor through powers of two, comparisons and subtraction. Its useful invariant is not that the numbers merely become smaller. Each transformation must preserve the odd common factor while accounting separately for any factor of two shared by both original inputs. Keeping that account explicit makes a short bit-oriented routine much easier to understand.
For positive integers a and b, write a as two to the s times an odd u, and b as two to the t times an odd v. Their greatest common divisor is two to the smaller of s and t times the greatest common divisor of u and v. The shared power must be restored at the end. Removing every trailing zero from both inputs without saving that smaller exponent would lose a real factor.
If only one current operand is even and the other is odd, dividing the even one by two preserves their greatest common divisor. An odd number cannot share an additional factor of two with it. These statements justify the normalization steps; they are stronger than an informal claim that shifts are convenient replacements for division.

When both operands are odd and unequal, replace the larger by its difference from the smaller. The greatest common divisor is unchanged because a divisor of both originals also divides their difference, and the reverse implication holds as well. The difference is even, so its trailing powers of two can then be removed without changing the remaining odd greatest common divisor.
The pair remains positive when subtraction is applied only to unequal positive operands. The larger value decreases, giving progress toward equality. Equality is a stopping condition: subtracting equal numbers would create zero, which needs special handling before any trailing-zero primitive. Several language and compiler intrinsics do not define a useful trailing-zero result for zero input.
Take a equal to eighty-four and b equal to thirty. Their trailing powers are two and one respectively, so save one common power of two. Removing the powers independently leaves the odd pair twenty-one and fifteen. Subtract fifteen from twenty-one to obtain six, then remove its factor of two to obtain three. The odd pair is now three and fifteen.
Subtract three from fifteen to obtain twelve, and remove its two trailing powers of two to obtain three. The pair has become three and three, so its odd greatest common divisor is three. Restoring the saved common factor two gives six. The original values are both divisible by six; simply returning the final odd value three would have missed part of their greatest common divisor.

The cited Linux function accepts unsigned long operands and checks whether either is zero before entering the positive-operand implementation. One zero input returns the other; its chosen behavior for two zero inputs is zero. A program should treat that last result as an interface convention rather than pretend that zero has a greatest positive divisor in the usual mathematical definition.
The independent author implementation also handles zero before counting trailing zeros. It first converts signed values to unsigned magnitudes, which avoids naively negating the minimum signed value. Nevertheless, a generic signed return type still needs a representability decision when a greatest common divisor is too large for that signed type. The positive, small integers in our example avoid that separate interface issue.
Linux includes a route using efficient find-first-set operations and an alternative normalization arrangement. The author implementation records both original trailing-zero counts, normalizes to odd values, repeatedly subtracts and restores the smaller saved count at return. These are related implementations of the invariant, not a guarantee that every source file follows our diagram's exact sequence of variable assignments.
The algorithm returns a divisor value. It does not automatically provide coefficients expressing that divisor as an integer combination of the original inputs. That additional output belongs to a different contract. Likewise, arithmetic correctness does not prove a universal performance advantage: available instructions, widths, compiler choices and operand distribution affect the practical comparison.
An independent check can divide both original inputs by the returned divisor and confirm that the resulting two quotients are coprime. Such a check concerns the mathematical answer, not how many machine instructions the routine executed.
The site's integer algorithm principles and technical features provide context for bit representation and mathematical invariants. Primary references: the Linux kernel's original binary greatest-common-divisor source and hitonanode's original implementation. Both figures are original AI-assisted arithmetic illustrations, with no benchmark claims or borrowed code screenshots.