https://github.com/torvalds/linux
Raw File
Tip revision: 57d54889cd00db2752994b389ba714138652e60c authored by Linus Torvalds on 08 March 2010, 18:45:44 UTC
Linux 2.6.34-rc1
Tip revision: 57d5488
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