On Tuesday, August 23, 2011 17:48:50 Anton Staaf wrote:
> I wasn't going to say it.  :)  How about something like this, which is
> very similar to what you had Mike, but doesn't define the array in the
> macro.  It's a bit clearer what is going on, but also requires a bit
> more work at each use.
> 
> #define DCACHE_RESIZE(size) ((size) + get_dcache_line_size() - 1)
> #define DCACHE_ALIGN(buffer) ((buffer) + get_dcache_line_size() - 1) &
> ~(get_dcache_line_size() - 1)
> 
> char buffer[DCACHE_RESIZE(100)];

as long as people always use a byte-sized type (i.e. char), this should work.  
obviously using "u32 buffer[...]" will be bad.

> It would be awesome if the idea below worked, but it can't because the
> array is popped when the ({...}) scope is exited I believe.

yes, i believe you are correct.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to