> Hi Dmitry, > Thanks for looking at this optimization.
> I would be interested to know how the algorithm also compares on code size.
> This is another important metric for avr-libc.
current variant takes 362 bytes .text and 209 bytes in .progmem
ltoa teakes (see benchmarks.html) 220-200 bytes.
But current libc de-facto contains two ltoa: ltoa and __ultoa_invert
(for printf). So if we replace one of them (__ultoa_invert) we will be
able to have a bit overhead.
Also I provided a few tables for a few radixes, I think that two
general radixes must be provided (10 and 16) or even only 10.
main cycle:
for (i = j = 0, first = 1; i < max; i++) {
unsigned long check = pgm_read_dword(d + i);
if (check > __val) {
if (first)
continue;
__s[j++] = '0';
continue;
}
first = k = 0;
while(check <= __val) {
__val -= check;
k++;
}
__s[j++] = pgm_read_byte(letters + k);
}
if (first)
__s[j++] = '0';
__s[j] = 0;
return __s;
can be rewritten using ASM and also be reduced. But I haven't enough
exps to do that.
> And could you please subscribe to the avr-libc mailing list? That way your
> posts do not have to be approved. :-)
avr-libc or avr-libc-dev?
I had subscribed avr-libc-dev and then sent the mail.
Here https://savannah.nongnu.org/mail/?group=avr-libc
I've found two maillist: avr-libc-dev and avr-libc-corelib. I've
subscribed avr-libc-dev because avr-libc-corelib is in inactive state
since 2010-08.
--
. ''`. Dmitry E. Oboukhov
: :’ : email: [email protected] jabber://[email protected]
`. `~’ GPGKey: 1024D / F8E26537 2006-11-21
`- 1B23 D4F8 8EC0 D902 0555 E438 AB8C 00CF F8E2 6537
signature.asc
Description: Digital signature
_______________________________________________ AVR-libc-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
