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

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