https://jxself.org/git/linux-libre.git
Raw File
Tip revision: ef68a7e087a85a158627e3b4f7e6c6eb22106578 authored by Jason Self on 05 April 2013, 17:18:33 UTC
Linux-libre 3.0.72-gnu1
Tip revision: ef68a7e
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