https://github.com/torvalds/linux
Raw File
Tip revision: 67a3e12b05e055c0415c556a315a3d3eb637e29e authored by Linus Torvalds on 30 May 2010, 20:21:02 UTC
Linux 2.6.35-rc1
Tip revision: 67a3e12
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