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

Mike Frysinger vapier at gentoo.org
Thu Sep 2 19:42:46 CEST 2010


On Tuesday, August 31, 2010 02:04:53 Reinhard Meyer wrote:
> making the change to the union, I also realized that
> 
> /* Copy from memory into linebuf and print hex values */
> for (i = 0; i < linelen; i++) {
> 	uint32_t x;
> 	if (width == 4)
> 		x = lb.u32[i] = *(volatile uint32_t *)data;
> 	else if (width == 2)
> 		x = lb.u16[i] = *(volatile uint16_t *)data;
> 	else
> 		x = lb.u8[i] = *(volatile uint8_t *)data;
> 	printf(" %0*x", width * 2, x);
> 	data += width;
> }
> 
> is still a bit "ugly". What about:

maybe, but as Wolfgang points out, the whole point of unifying these code 
paths was to shrink code.  re-expanding it just so that the printf is clear is 
not worthwhile imo.  personally (and probably since i'm the one who changed 
the 3xprintf into 1 printf) find the field width version easier to understand.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100902/50570b16/attachment.pgp 


More information about the U-Boot mailing list