![]() |
|
|||
0001 // SPDX-License-Identifier: GPL-2.0 0002 /* 0003 * Count the digits of @val including a possible sign. 0004 * 0005 * (Typed on and submitted from hpa's mobile phone.) 0006 */ 0007 int num_digits(int val) 0008 { 0009 int m = 10; 0010 int d = 1; 0011 0012 if (val < 0) { 0013 d++; 0014 val = -val; 0015 } 0016 0017 while (val >= m) { 0018 m *= 10; 0019 d++; 0020 } 0021 return d; 0022 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |