aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-18 20:43:11 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-18 20:43:28 +0530
commitcfdd7456118743812b44cd76ca2d080b68dc1bff (patch)
treead8c32b561df2f8f4424904cb50866b454c31cd3
parent9b054d51f4e3f87e2a606bc010408c32ec3f2c9b (diff)
downloadnnn-cfdd7456118743812b44cd76ca2d080b68dc1bff.tar.gz
Get rid of modulo operation
-rw-r--r--src/nnn.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 987d098..f9ab3aa 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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];
}