https://github.com/torvalds/linux
Raw File
Tip revision: 805a6af8dba5dfdd35ec35dc52ec0122400b2610 authored by Linus Torvalds on 04 January 2012, 23:55:44 UTC
Linux 3.2
Tip revision: 805a6af
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