https://jxself.org/git/linux-libre.git
Raw File
Tip revision: 0668ee721aa8583379f5b5f4b13b56971954f703 authored by Jason Self on 03 March 2013, 22:09:36 UTC
Linux-libre 3.0.68-gnu1
Tip revision: 0668ee7
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