Version:  2.0.40 2.2.26 2.4.37 3.13 3.14 3.15 3.16 3.17 3.18 3.19 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10

Linux/lib/lcm.c

  1 #include <linux/compiler.h>
  2 #include <linux/gcd.h>
  3 #include <linux/export.h>
  4 #include <linux/lcm.h>
  5 
  6 /* Lowest common multiple */
  7 unsigned long lcm(unsigned long a, unsigned long b)
  8 {
  9         if (a && b)
 10                 return (a / gcd(a, b)) * b;
 11         else
 12                 return 0;
 13 }
 14 EXPORT_SYMBOL_GPL(lcm);
 15 
 16 unsigned long lcm_not_zero(unsigned long a, unsigned long b)
 17 {
 18         unsigned long l = lcm(a, b);
 19 
 20         if (l)
 21                 return l;
 22 
 23         return (b ? : a);
 24 }
 25 EXPORT_SYMBOL_GPL(lcm_not_zero);
 26 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us