[U-Boot-Users] [patch 01/10] consolidate sizes.h

Wolfgang Denk wd at denx.de
Sun Mar 18 02:17:02 CET 2007

In message <1defaf580703171318i445b74dcx6c62eda8d0a0ae80 at mail.gmail.com> you wrote:
> Anyway, why do we need all these definitions? Wouldn't it be enough to
> define SZ_1K, SZ_1M and SZ_1G so that you can get any size you want by
> using expressions like (32 * SZ_1K)?

Let's do it right, and get rid of this stuff completely.

This is one of the areas where somebody tried to be clever, and

Instead of making the code more readable, it obfucates it.

What is "SZ_1K" - in which units is size measured? Bytes? Words? Disk

And what is 1K ? Is it 1000 or 1024?

Even worse: what is 1M? 1000*1000 or 1000*1024 or 1024*0124?

See http://en.wikipedia.org/wiki/KiB for details.

If you want to make this standard-conforming, then you have to write
SZ_1KiB, SZ_1MiB - and it's still mostly unreadable.

Where is the problem with writing "(32 * 1024)" instead of
"(32 * SZ_1K)" ? The former is *shorter* *and* much better readable...

> Not that I object to the patch -- consolidating these definitions is a
> very good thing.

No. Any work on these is wasted. Please throw them out.

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Fascinating is a word I use for the unexpected.
	-- Spock, "The Squire of Gothos", stardate 2124.5

More information about the U-Boot mailing list