Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: d9875690d9b89a866022ff49e3fcea892345ad92 authored by Linus Torvalds on 16 August 2012, 21:51:24 UTC
Linux 3.6-rc2
Tip revision: d987569
gcd.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/export.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