https://github.com/torvalds/linux
Raw File
Tip revision: da5cabf80e2433131bf0ed8993abc0f7ea618c73 authored by Linus Torvalds on 16 August 2010, 00:41:37 UTC
Linux 2.6.36-rc1
Tip revision: da5cabf
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