diff options
-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; |
index : op-kernel-dev | ||
Development kernel branch for OpenPOWER systems | Raptor Engineering, LLC |
summaryrefslogtreecommitdiffstats |
-rw-r--r-- | lib/gcd.c | 3 |
@@ -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; |