[U-Boot] [PATCH] display_buffer: fix misaligned buffer

Reinhard Meyer u-boot at emk-elektronik.de
Mon Aug 30 11:39:30 CEST 2010


Reinhard Meyer schrieb:
>> +	uint32_t linebuf[MAX_LINE_LENGTH_BYTES/4 + 1];
>>>  	uint32_t *uip = (void*)linebuf;
>>>  	uint16_t *usp = (void*)linebuf;
>>>  	uint8_t *ucp = (void*)linebuf;
> I personally prefer this above an attribute. Its disputeable but I prefer
> to do things with "normal C constructs" where possible.
Reading this, after it had been sent, a perfect patch
should make the buffer an union:

union {
	uint32_t ui[MAX.../4+1];
	uint16_t us[MAX.../2+1];
	uint8_t  uc[MAX...+1];
} linebuf;

Reinhard



More information about the U-Boot mailing list