Dick Hollenbeck wrote:
>> That could be worked around by using C99 initializers. I am not fond of
>> replacing a small amount of static data with a bigger chunk of code.
>>   
>
> Are you thinking it is bigger because it looks bigger in your editor,
> or bigger because it generates more code?    Switch statements can be
> handled quite efficiently by the compiler if the case statements are
> of contiguous values, and I believe that is the case we are talking
> about.
Sure? The best I have seen are jump tables, which means 1 pointer + 1
load instruction + 1 branch/return per case, compared with a single
indexed memory load - this looks quite bloaty to me, not only in terms
of code size, but also execution speed (pipeline flush). A short test
using gcc 4.3 (i386) and 4.2.3 (arm) seems to confirm this suspection.

> C99:  are you saying use #defines as the array indices in the
> initializers?
> That could be an acceptable alternative.
That was the general idea. If it is not sufficient, I would next suggest
trying compile-time asserts (which add zero overhead/code) to make sure
breakage does not go undetected.

cu
Michael

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to