swh:1:snp:32555a3fd8878f019c2ebd6c964bc1edcaeff337
Raw File
Tip revision: b419148e567728f6af0c3b01965c1cc141e3e13a authored by Linus Torvalds on 03 November 2009, 19:37:49 UTC
Linux 2.6.32-rc6
Tip revision: b419148
gcd.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/module.h>

/* 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);
back to top