https://github.com/torvalds/linux
Raw File
Tip revision: 62aa2b537c6f5957afd98e29f96897419ed5ebab authored by Linus Torvalds on 31 January 2012, 21:31:54 UTC
Linux 3.3-rc2
Tip revision: 62aa2b5
lcm.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/module.h>
#include <linux/lcm.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