Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: 976d167615b64e14bc1491ca51d424e2ba9a5e84 authored by Linus Torvalds on 05 October 2011, 01:11:50 UTC
Linux 3.1-rc9
Tip revision: 976d167
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