projects
/
kernel
/
linux-3.0.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
433d89bd9d899bb538ff1fa2546f9888937918ec
[kernel/linux-3.0.git]
/
lib
/
gcd.c
1
#include <linux/kernel.h>
2
#include <linux/gcd.h>
3
#include <linux/module.h>
4
5
/* Greatest common divisor */
6
unsigned long gcd(unsigned long a, unsigned long b)
7
{
8
unsigned long r;
9
10
if (a < b)
11
swap(a, b);
12
13
if (!b)
14
return a;
15
while ((r = a % b) != 0) {
16
a = b;
17
b = r;
18
}
19
return b;
20
}
21
EXPORT_SYMBOL_GPL(gcd);