diff options
author | Dan Williams <dan.j.williams@intel.com> | 2010-05-17 16:30:58 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-05-17 16:30:58 -0700 |
commit | 0b28330e39bbe0ffee4c56b09fc415fcec595ea3 (patch) | |
tree | fcf504879883763557e696eff81427b1ab78f76b /lib/lcm.c | |
parent | 058276303dbc4ed089c1f7dad0871810b1f5ddf1 (diff) | |
parent | caa20d974c86af496b419eef70010e63b7fab7ac (diff) |
Merge branch 'ioat' into dmaengine
Diffstat (limited to 'lib/lcm.c')
-rw-r--r-- | lib/lcm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/lcm.c b/lib/lcm.c new file mode 100644 index 00000000000..157cd88a6ff --- /dev/null +++ b/lib/lcm.c @@ -0,0 +1,15 @@ +#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); |