Zach Welch wrote:
> On Fri, 2009-04-24 at 18:39 +0200, Magnus Lundin wrote:
> [snip]
>   
>>>                        static tap_state_t exception_path[] = {
>>>                            TAP_DREXIT2,
>>>                            TAP_DRSHIFT,
>>>                            TAP_DREXIT1,
>>>                            TAP_DRUPDATE,
>>>                            TAP_IDLE,
>>>                        };
>>>
>>>                        jtag_add_pathmove( 
>>> sizeof(exception_path)/sizeof(exception_path[0]), exception_path);
>>>       
>
> Can we stick the following somewhere in the code:
>
> #define ARRAYSIZEOF(x) (sizeof(x) / sizeof((x)[0]))
>   

DIM()  is shorter.

> and use it instead of that underlying expression?  I use this macro in
> my projects frequently, but I always wonder if it could be #include'd
> from a standard header.  Anyway, to take your example one step further:
>
> #define JTAG_ADD_PATH_EXCEPTIONS(x) \
>               jtag_add_pathmove(ARRAYSIZEOF(x), x);
>
> then:
>
>       JTAG_ADD_PATH_EXCEPTIONS(exception_path);
>   

No thanks to this 2nd one, this obscures things.


                jtag_add_pathmove( DIM(x), x);

Is preferred.

Dick

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

Reply via email to