avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] More observations: array of pointers to functions


From: Eric Weddington
Subject: RE: [avr-gcc-list] More observations: array of pointers to functions
Date: Mon, 26 Feb 2007 13:22:51 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of David McNab
> Sent: Sunday, February 25, 2007 5:16 PM
> To: address@hidden
> Subject: [avr-gcc-list] More observations: array of pointers 
> to functions
> 
> I tried the approach of:
> 
>    fptr = (FuncPtr)pgm_read_word(&funcs_table[0] + i * 2);
> 
> but it has a huge footprint of 48 bytes - terrible for repeated use.
> 
> If anyone can come up with a scheme that's better - for code 
> readability
> and/or compactness, I'd be grateful to hear about it.


Did you try Royce's suggestion that he made in response to your earlier
email? It's perhaps the most readable. Though I will admit, I haven't taken
a look at the size of the code that it produces.

The line that you have above does some pretty needles math. You should be
able to just simply do:

    fptr = (FuncPtr)pgm_read_word(&funcs_table[i]);

Does that make any difference in the size of your code? It would be
interesting to know one way or the other...

Eric





reply via email to

[Prev in Thread] Current Thread [Next in Thread]