https://github.com/torvalds/linux
Raw File
Tip revision: e44a21b7268a022c7749f521c06214145bd161e4 authored by Linus Torvalds on 06 June 2010, 03:43:24 UTC
Linux 2.6.35-rc2
Tip revision: e44a21b
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