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};
|
||||
int i = 30;
|
||||
uint rem;
|
||||
|
||||
if (!val)
|
||||
return "0";
|
||||
|
||||
for (; val && i; --i, val /= 10)
|
||||
ascbuf[i] = '0' + (val % 10);
|
||||
while (val && i) {
|
||||
rem = val / 10;
|
||||
ascbuf[i] = '0' + (val - (rem * 10));
|
||||
val = rem;
|
||||
--i;
|
||||
}
|
||||
|
||||
return &ascbuf[++i];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue