[U-Boot] Question: is SZ_* going to be removed or not?
Wolfgang Denk
wd at denx.de
Wed Jan 26 13:59:52 CET 2011
Dear Reinhard Meyer,
In message <4D3FECB2.1010007 at emk-elektronik.de> you wrote:
>
> Will the preffered methods be
> xx << 10 for KiB
> xx << 20 for MiB
> xx << 30 for GiB and so on?
Please note that the binary prefixes kibi and mebi not might be used
for other things than bytes as well. And if we were trying to be
precise, wie might want to use "octets" instead of bytes anyway ;-)
I think it's largely a matter of taste and experience whether you
prefer (2 << 30) or (2 * 1024 * 1024 * 1024). It depends a lot on how
much you work with such numbers - I prefer (2 << 30) because it's
shorter, others find the "* 1024" notation easier to read.
But no matter what you prefer - at least both variants are readable.
> Or might we have a few macros like
>
> #define KiB(x) ((x) << 10)
> #define MiB(x) ((x) << 20) and so on?
Why should we use any such macros at all? Just write the plain
numbers in the code so everybody can understand it without having to
look up the definition.
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
Severe culture shock results when experts from another protocol suite
[...] try to read OSI documents. The term "osified" is used to refer
to such documents. [...] Any relationship to the word "ossified" is
purely intentional. - Marshall T. Rose
More information about the U-Boot
mailing list