[U-Boot] [PATCH 1/1] arm: clean sizes.h
Wolfgang Denk
wd at denx.de
Sat May 2 20:32:11 CEST 2009
Dear Jean-Christophe PLAGNIOL-VILLARD,
In message <1241219918-22846-1-git-send-email-plagnioj at jcrosoft.com> you wrote:
> remove duplicated and clean it
Please just remove this. I mean, without attempting to clean it up.
[And not only on ARM, but everywhere.]
I never understood why "SZ_8K" would be better than 8192 or 8*1024 ?
Note that, apart from personal preferences, these "helpful" defi-
nitions are misleading and at least sometimes even plain wrong. See
below for details.
....
> --- a/include/asm-arm/sizes.h
> +++ b/include/asm-arm/sizes.h
> @@ -16,7 +16,7 @@
> /* DO NOT EDIT!! - this file automatically generated
> * from .s file by awk -f s2h.awk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It seems you ignore this warning? Is this a wise thing to do?
> /* handy sizes */
> +#define SZ_16 0x00000010
> +#define SZ_256 0x00000100
> +#define SZ_512 0x00000200
NAK. I will not accept a patch that adds such definitions. That's
ridiculous. What is the problem of writing "16" when you mean "16"?
Why would "SZ_512" be any better than plain "512" - except that it's
twice as much to type.
> #define SZ_1K 0x00000400
> #define SZ_4K 0x00001000
> #define SZ_8K 0x00002000
Please keep in mind that "K", "M", and "G" are non-standard prefixes,
and it is not clear if they refer to decimal or binary multiples.
This makes their use in the code a PITA.
We should try to be precise, and we should follow existing standards.
Prefixes and symbols for binary multiples are standardized in IEC
60027-2. [They are not part of the SI metric system of units,
though.] Correct names for 1024 = (1 << 10), 1024*1024 = ( 1 << 20)
and 1024*1024*1024 = (1 << 30) are "kibi" (kilobinary, abbreviated as
"Ki"), "mebi" (megabinary, "Mi"), and "gibi" (gigabinary, "Gi"),
respective. Note that this is "Ki", not "K".
So if you think youmust define something that means 8192, then please
name it "8 Ki", as "Ki" is the correct, standardized symbol for the
name "kibi", meaning "kilobinary".
With "8 K", nobody ever knows for sure what is meant - is it 8*10**3
or is it 8*2**10.
Thus my urgent recommendation: let's get rid of all this ambiguous
SZ_* definitions and use numbers. "8 * 1024" is at least as readable
as "SZ_8K", and it leaves no doubt what might be meant.
Thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is dangerous to be right on a subject on which the established
authorities are wrong. -- Voltaire
More information about the U-Boot
mailing list