https://jxself.org/git/linux-libre.git
Raw File
Tip revision: aa95e7da9dfa2cbf38c2cc7936112aac7acbac2c authored by Jason Self on 19 May 2013, 17:06:01 UTC
Linux-libre 3.0.79-gnu1
Tip revision: aa95e7d
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);

	if (!b)
		return a;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
EXPORT_SYMBOL_GPL(gcd);
back to top