This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
2009-06-17 23:28:38 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/gcd.h>
|
2011-11-17 02:29:17 +00:00
|
|
|
#include <linux/export.h>
|
2009-06-17 23:28:38 +00:00
|
|
|
|
|
|
|
/* Greatest common divisor */
|
|
|
|
unsigned long gcd(unsigned long a, unsigned long b)
|
|
|
|
{
|
|
|
|
unsigned long r;
|
|
|
|
|
|
|
|
if (a < b)
|
|
|
|
swap(a, b);
|
|
|
|
while ((r = a % b) != 0) {
|
|
|
|
a = b;
|
|
|
|
b = r;
|
|
|
|
}
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(gcd);
|