nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cfdd7456118743812b44cd76ca2d080b68dc1bff
parent 9b054d51f4e3f87e2a606bc010408c32ec3f2c9b
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Sat, 18 Jan 2020 20:43:11 +0530

Get rid of modulo operation

Diffstat:
Msrc/nnn.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 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]; }