Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: dcd6c92267155e70a94b3927bce681ce74b80d1f authored by Linus Torvalds on 19 January 2012, 23:04:48 UTC
Linux 3.3-rc1
Tip revision: dcd6c92
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