2010-03-15 12:46:51 +01:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/gcd.h>
|
2011-11-17 03:29:17 +01:00
|
|
|
#include <linux/export.h>
|
2011-07-26 02:13:20 +02:00
|
|
|
#include <linux/lcm.h>
|
2010-03-15 12:46:51 +01:00
|
|
|
|
|
|
|
/* 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);
|