ethersex/ethersex — pull request #330 by jm493 (2014-06-10 07:17:35+00:00)
Title: itoa_fixedpoint: combined digit loop

Hi,

I have combined the leading-0, normal digits, and fixeddigits code into one loop.
This reduces code size by ~75 bytes.

I have tested the code using a test main program, not in ethersex.

Thanks,
John

```
#include
#include "fixedpoint.h"

void
test (int n)
{
int digits, len;
char s[20];
printf("n=%d : ", n);
for (digits = 0; digits <= 4; digits++) {
len = itoa_fixedpoint (n, digits, s);
printf("%d => '%*s', ", digits, len, s);
}
printf("\n");
}

main ()
{
test(-1);
test(0);
test(1);
test(10);
test(100);
test(1000);
test(9999);
test(10000);
test(10001);
test(32767);
test(-32767);
}
```