projects
/
linux-block.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Merge tag 'livepatching-for-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git]
/
arch
/
x86
/
lib
/
misc.c
1
// SPDX-License-Identifier: GPL-2.0
2
#include <asm/misc.h>
3
4
/*
5
* Count the digits of @val including a possible sign.
6
*
7
* (Typed on and submitted from hpa's mobile phone.)
8
*/
9
int num_digits(int val)
10
{
11
int m = 10;
12
int d = 1;
13
14
if (val < 0) {
15
d++;
16
val = -val;
17
}
18
19
while (val >= m) {
20
m *= 10;
21
d++;
22
}
23
return d;
24
}