Skip to contentSkip to conversation

Question: is SZ_* going to be removed or not?

U-Boot Reinhard Meyer 3 participants 6 messages Jan 26, 2011

lore
Share & tools
lore
#0 lore raw

Hello Wolfgang,

I heard rumors that the SZ_* defines are going to be outphased.

If so, new submissions should not use them anymore, right?

Best Regards,
Reinhard

#1 lore raw

Dear Reinhard Meyer,

Quoted 2 lines · In message <[email protected]> you wrote:

I heard rumors that the SZ_* defines are going to be outphased.

I's on my personal hate list, indeed.

Quoted 1 line

If so, new submissions should not use them anymore, right?

Right.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
When you die, the first thing you lose is your life. The  next  thing
is the illusions.                       - Terry Pratchett, _Pyramids_
#2 lore raw

Hi Wolfgang,

Quoted 10 lines · Wolfgang Denk
Quoted 2 lines · In message<[email protected]> you wrote:

I heard rumors that the SZ_* defines are going to be outphased.

I's on my personal hate list, indeed.

Quoted 1 line

If so, new submissions should not use them anymore, right?

Right.

so what is the recommended way to write size ?

Thanks,
Eric

#3 lore raw

Dear =?ISO-8859-1?Q?Eric_B=E9nard?=,

Quoted 2 lines · In message <[email protected]> you wrote:

so what is the recommended way to write size ?

In a readable way.

If you need 2k, write it as 2000 or 2*1000 or similar.

If you need 2 Ki, write it as 2048 or 2*1024 or (2 << 10) or similar.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: [email protected]
Q:  What's a light-year?
A:  One-third less calories than a regular year.
#4 lore raw
In reply to Wolfgang Denk

Dear Wolfgang Denk,

Quoted 11 lines

Dear Reinhard Meyer,

Quoted 2 lines · In message <[email protected]> you wrote:

I heard rumors that the SZ_* defines are going to be outphased.

I's on my personal hate list, indeed.

Quoted 1 line

If so, new submissions should not use them anymore, right?

Right.

OK, I can understand that for having a define for each of the 64 possible values (1<<0) .. (1<<63) can be annoying.

Will the preffered methods be
xx << 10 for KiB
xx << 20 for MiB
xx << 30 for GiB and so on?

Or might we have a few macros like

#define KiB(x) ((x) << 10)
#define MiB(x) ((x) << 20) and so on?

That would reduce all to about 6 defines.

Best Regards,
Reinhard

#5 lore raw

Dear Reinhard Meyer,

Quoted 5 lines · In message <[email protected]> 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 -@least both variants are readable.

Quoted 4 lines

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

Signature · 7 lines
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: [email protected]
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