repo.or.cz
/
linux
/
fpc-iii.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git]
/
arch
/
x86
/
lib
/
misc.c
blob
a018ec4fba53ef456264b14dabfdf30575e346f5
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
int
num_digits
(
int
val
)
8
{
9
int
m
=
10
;
10
int
d
=
1
;
11
12
if
(
val
<
0
) {
13
d
++;
14
val
= -
val
;
15
}
16
17
while
(
val
>=
m
) {
18
m
*=
10
;
19
d
++;
20
}
21
return
d
;
22
}