staging: zcache: cleanup the code between tmem_obj_init and tmem_obj_find
[linux-2.6.git] / lib / gcd.c
blobcce4f3cd14b36f1511b7372a5c8a8106b9495437
1 #include <linux/kernel.h>
2 #include <linux/gcd.h>
3 #include <linux/export.h>
5 /* Greatest common divisor */
6 unsigned long gcd(unsigned long a, unsigned long b)
8 unsigned long r;
10 if (a < b)
11 swap(a, b);
12 while ((r = a % b) != 0) {
13 a = b;
14 b = r;
16 return b;
18 EXPORT_SYMBOL_GPL(gcd);