diff options
Diffstat (limited to 'lib/gcd.c')
-rw-r--r-- | lib/gcd.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -9,6 +9,9 @@ unsigned long gcd(unsigned long a, unsigned long b) if (a < b) swap(a, b); + + if (!b) + return a; while ((r = a % b) != 0) { a = b; b = r; |