Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f authored by Linus Torvalds on 21 June 2011, 03:25:46 UTC
Linux 3.0-rc4
Tip revision: 5629937
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