LCOV - code coverage report
Current view: top level - arch/x86/lib - misc.c (source / functions) Hit Total Coverage
Test: landlock.info Lines: 6 10 60.0 %
Date: 2021-04-22 12:43:58 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  * Count the digits of @val including a possible sign.
       4             :  *
       5             :  * (Typed on and submitted from hpa's mobile phone.)
       6             :  */
       7           6 : int num_digits(int val)
       8             : {
       9           6 :         int m = 10;
      10           6 :         int d = 1;
      11             : 
      12           6 :         if (val < 0) {
      13           0 :                 d++;
      14           0 :                 val = -val;
      15             :         }
      16             : 
      17           6 :         while (val >= m) {
      18           0 :                 m *= 10;
      19           0 :                 d++;
      20             :         }
      21           6 :         return d;
      22             : }

Generated by: LCOV version 1.14