aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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];
}