Revision 78bcb11d2bb1a69c4dca5dcb5ebcfb8f2d71974f authored by Jason Self on 19 February 2016, 22:23:05 UTC, committed by Jason Self on 19 February 2016, 22:23:05 UTC
0 parent
Raw File
lcm.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/export.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