All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Question: is SZ_* going to be removed or not?
Date: Wed, 26 Jan 2011 13:59:52 +0100	[thread overview]
Message-ID: <20110126125952.2EAF1CD1385@gemini.denx.de> (raw)
In-Reply-To: <4D3FECB2.1010007@emk-elektronik.de>

Dear Reinhard Meyer,

In message <4D3FECB2.1010007@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 -@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@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

      reply	other threads:[~2011-01-26 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26  8:28 [U-Boot] Question: is SZ_* going to be removed or not? Reinhard Meyer
2011-01-26  9:20 ` Wolfgang Denk
2011-01-26  9:29   ` Eric Bénard
2011-01-26  9:43     ` Wolfgang Denk
2011-01-26  9:43   ` Reinhard Meyer
2011-01-26 12:59     ` Wolfgang Denk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110126125952.2EAF1CD1385@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.