mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Get rid of modulo operation
This commit is contained in:
parent
9b054d51f4
commit
cfdd745611
|
@ -641,12 +641,17 @@ static char *xitoa(uint val)
|
||||||
{
|
{
|
||||||
static char ascbuf[32] = {0};
|
static char ascbuf[32] = {0};
|
||||||
int i = 30;
|
int i = 30;
|
||||||
|
uint rem;
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return "0";
|
return "0";
|
||||||
|
|
||||||
for (; val && i; --i, val /= 10)
|
while (val && i) {
|
||||||
ascbuf[i] = '0' + (val % 10);
|
rem = val / 10;
|
||||||
|
ascbuf[i] = '0' + (val - (rem * 10));
|
||||||
|
val = rem;
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
|
||||||
return &ascbuf[++i];
|
return &ascbuf[++i];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue