swh:1:snp:c7beb2432b7e93c4cf6ab09cd194c7c1998df2f9
Raw File
Tip revision: caca6a03d365883564885f2c1da3e88dcf65d139 authored by Linus Torvalds on 24 November 2011, 04:20:28 UTC
Linux 3.2-rc3
Tip revision: caca6a0
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