public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks
Date: Tue, 12 Jul 2011 21:30:29 +0200	[thread overview]
Message-ID: <20110712193029.5571F16F12CE@gemini.denx.de> (raw)
In-Reply-To: <CAF6FioVs5rsF27Boq9+Bb+3Cgdh2m=jj1c=41a-32muBUd9wtw@mail.gmail.com>

Dear Anton Staaf,

In message <CAF6FioVs5rsF27Boq9+Bb+3Cgdh2m=jj1c=41a-32muBUd9wtw@mail.gmail.com> you wrote:
> 
> > Sorry, but because such code is unportable we do not accept it, as it
> > would lead to driver code that becomes unportable, too.
> >
> > I know that this is throwing more fuel on the fire (for which I am sorry),

You don't have to apologize.  I think it is important that everybody
understands the reasons behind such decisions.

> but I don't follow the argument that this is unportable.  As far as I can
> tell, the # : # syntax is not using any special compiler extensions, it is
> simply substituted into a (boo) ? # : # expression, thus extracting either
> the first of second number from the definition of the bit field.
> 
> If I am wrong I would be interested to know what about this is not standard
> pre-processor usage?

I did not say anything about preprocessor issues.  The use of bit
numbers (and ranges of bit numbers) in code is inherently unportable.

For example:

"Bit 10" means 0x00000400 on some systems (like, for example, on ARM),
but  it  means 0x00200000 on others (like, for example, on PPC).

On many systems bit 0 means trhe LSB, but the Power Architecture
defines it as the MSB.  Thus bit numbers should never be used in any
code to access bits or to create masks etc. - they are not generally
applicable.

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
"In Christianity neither morality nor religion come into contact with
reality at any point."                          - Friedrich Nietzsche

  parent reply	other threads:[~2011-07-12 19:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05 16:49 [U-Boot] [RESEND PATCH v2 0/5] Add basic clock and pinmux functions to the Tegra2 Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks Simon Glass
2011-07-09 13:56   ` Albert ARIBAUD
2011-07-11  4:34     ` Simon Glass
2011-07-11  6:16       ` Wolfgang Denk
2011-07-11 16:19         ` Anton Staaf
2011-07-12 15:29           ` Albert ARIBAUD
2011-07-12 16:48             ` Anton Staaf
2011-07-12 19:30           ` Wolfgang Denk [this message]
2011-07-12 20:59             ` Anton Staaf
2011-07-12 21:18               ` Wolfgang Denk
2011-07-12 23:11                 ` Anton Staaf
2011-07-13 11:28                   ` Detlev Zundel
2011-07-13 16:47                     ` Anton Staaf
2011-07-14 16:00                       ` Albert ARIBAUD
2011-07-14 17:29                         ` Anton Staaf
2011-07-14 18:26                           ` Albert ARIBAUD
2011-07-14 18:30                           ` Wolfgang Denk
2011-07-14 18:42                             ` Anton Staaf
2011-07-14 18:44                   ` Wolfgang Denk
2011-07-14 20:06                     ` Anton Staaf
2011-07-11  6:13   ` Wolfgang Denk
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 2/5] Tegra2: Add microsecond timer functions Simon Glass
2011-07-09 13:58   ` Albert ARIBAUD
2011-07-10  5:24   ` Graeme Russ
2011-07-10  6:14     ` Simon Glass
2011-07-10  6:54       ` Graeme Russ
2011-07-11  6:17     ` Wolfgang Denk
2011-07-11  6:20     ` Wolfgang Denk
2011-07-11  6:43       ` Graeme Russ
2011-07-11 19:58         ` Wolfgang Denk
2011-07-11 22:52           ` Graeme Russ
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 3/5] Tegra2: Add more clock support Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 4/5] Tegra2: add additional pin multiplexing features Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 5/5] Tegra2: Use clock and pinmux functions to simplify code Simon Glass

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=20110712193029.5571F16F12CE@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox