https://github.com/torvalds/linux
Raw File
Tip revision: 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 authored by Linus Torvalds on 05 January 2011, 00:50:19 UTC
Linux 2.6.37
Tip revision: 3c0eee3
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