https://github.com/torvalds/linux
Raw File
Tip revision: 76be97c1fc945db08aae1f1b746012662d643e97 authored by Linus Torvalds on 23 August 2010, 00:43:29 UTC
Linux 2.6.36-rc2
Tip revision: 76be97c
lcm.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/module.h>

/* Lowest common multiple */
unsigned long lcm(unsigned long a, unsigned long b)
{
	if (a && b)
		return (a * b) / gcd(a, b);
	else if (b)
		return b;

	return a;
}
EXPORT_SYMBOL_GPL(lcm);
back to top