swh:1:snp:77163734605b0ec556b01d897b7bb4a7e30d46b6
Raw File
Tip revision: 01bf0b64579ead8a82e7cfc32ae44bc667e7ad0f authored by Linus Torvalds on 19 April 2010, 23:29:56 UTC
Linux 2.6.34-rc5
Tip revision: 01bf0b6
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