LCOV - code coverage report
Current view: top level - lib/math - lcm.c (source / functions) Hit Total Coverage
Test: gcov_data_raspi2_qemu_modules_combined.info Lines: 3 7 42.9 %
Date: 2020-09-30 20:25:01 Functions: 1 2 50.0 %
Branches: 1 6 16.7 %

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: GPL-2.0-only
       2                 :            : #include <linux/compiler.h>
       3                 :            : #include <linux/gcd.h>
       4                 :            : #include <linux/export.h>
       5                 :            : #include <linux/lcm.h>
       6                 :            : 
       7                 :            : /* Lowest common multiple */
       8                 :        808 : unsigned long lcm(unsigned long a, unsigned long b)
       9                 :            : {
      10         [ +  - ]:        808 :         if (a && b)
      11                 :        808 :                 return (a / gcd(a, b)) * b;
      12                 :            :         else
      13                 :            :                 return 0;
      14                 :            : }
      15                 :            : EXPORT_SYMBOL_GPL(lcm);
      16                 :            : 
      17                 :          0 : unsigned long lcm_not_zero(unsigned long a, unsigned long b)
      18                 :            : {
      19                 :          0 :         unsigned long l = lcm(a, b);
      20                 :            : 
      21         [ #  # ]:          0 :         if (l)
      22                 :            :                 return l;
      23                 :            : 
      24         [ #  # ]:          0 :         return (b ? : a);
      25                 :            : }
      26                 :            : EXPORT_SYMBOL_GPL(lcm_not_zero);

Generated by: LCOV version 1.14