Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: a102a9ece5489e1718cd7543aa079082450ac3a2 authored by Linus Torvalds on 27 September 2011, 22:48:34 UTC
Linux 3.1-rc8
Tip revision: a102a9e
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