Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: f6f94e2ab1b33f0082ac22d71f66385a60d8157f authored by Linus Torvalds on 20 October 2010, 20:30:22 UTC
Linux 2.6.36
Tip revision: f6f94e2
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