[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?
From: |
David Brown |
Subject: |
Re: [avr-gcc-list] Initilizing complex const arrays : syntax ? |
Date: |
Tue, 20 Sep 2005 09:41:54 +0200 |
> On Monday 19 Sep 2005 17:11, David Brown wrote:
> >...
>
> Nice code.
> My other solution would be to put the powers of ten in an array and
> compare them instead of doing the division, but I think your code will
> probably be faster.
>
> It might be possible to merge the two methods and put your bit patterns
> and increments in a constant structure, and then iterate over them. For
> smaller code size with marginal speed penalty.
>
> --
> Richard Urwin
>
It's possible that putting the patterns in a structure might save a small
amount of code, but I think not noticably for the three-digit case, and it
would be at least twice as slow (you'd have to do a lot more 16-bit
arithmetic). If you wanted to extend the idea to, say, 5 digits, then
that's a different matter - you'd get smaller code, and marginal speed
penalty since you need to do 16-bit arithmetic anyway (it's important to
note that the "lo" byte never overflows). Maybe it would be interesting to
re-implement utoa using that method.
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, (continued)
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Richard Urwin, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/18
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Dave Hansen, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Brown, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Richard Urwin, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?,
David Brown <=
- [avr-gcc-list] OT Generic C question, Trampas, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Bernard Fouché, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Colin Paul Gloster, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, David Brown, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Trampas, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Richard Urwin, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Alan Kilian, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Richard Urwin, 2005/09/22