diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-18 20:43:11 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-18 20:43:28 +0530 |
commit | cfdd7456118743812b44cd76ca2d080b68dc1bff (patch) | |
tree | ad8c32b561df2f8f4424904cb50866b454c31cd3 | |
parent | 9b054d51f4e3f87e2a606bc010408c32ec3f2c9b (diff) | |
download | nnn-cfdd7456118743812b44cd76ca2d080b68dc1bff.tar.gz |
Get rid of modulo operation
-rw-r--r-- | src/nnn.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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]; } |