From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 2 Sep 2010 13:42:46 -0400 Subject: [U-Boot] [PATCH] display_buffer: fix misaligned buffer In-Reply-To: <4C7C9B85.6080202@emk-elektronik.de> References: <1282940584-27957-1-git-send-email-u-boot@emk-elektronik.de> <4C7C9550.2010703@free.fr> <4C7C9B85.6080202@emk-elektronik.de> Message-ID: <201009021342.47729.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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