Blame view
lib/gcd.c
313 Bytes
d28292246
|
1 2 |
#include <linux/kernel.h> #include <linux/gcd.h> |
8bc3bcc93
|
3 |
#include <linux/export.h> |
d28292246
|
4 5 6 7 8 9 10 11 |
/* Greatest common divisor */ unsigned long gcd(unsigned long a, unsigned long b) { unsigned long r; if (a < b) swap(a, b); |
e96875677
|
12 13 14 |
if (!b) return a; |
d28292246
|
15 16 17 18 19 20 21 |
while ((r = a % b) != 0) { a = b; b = r; } return b; } EXPORT_SYMBOL_GPL(gcd); |