https://github.com/torvalds/linux
Raw File
Tip revision: b0c3844d8af6b9f3f18f31e1b0502fbefa2166be authored by Linus Torvalds on 16 December 2010, 01:24:48 UTC
Linux 2.6.37-rc6
Tip revision: b0c3844
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