[U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks

Anton Staaf robotboy at chromium.org
Mon Jul 11 18:19:28 CEST 2011


On Mon, Jul 11, 2011 at 1:16 AM, Wolfgang Denk <wd at denx.de> wrote:

> Dear Simon Glass,
>
> In message <CAPnjgZ1Oymaa2_gQGxw88jJG2Kr_fN6tJ5HDgUiOHPjw7jX2=
> g at mail.gmail.com> you wrote:
> >
> > > Not sure I follow you: the added lines below do indeed add bitfield
> access
> > > macros, don't they?
> > >
> > > No these are just for defining the shifts and masks. There is no access
>
> But you write yourself in the comment: "...easily getting mask and
> shift values for bit fields".
>
> > The only benefit is to avoid having to calculate all of these masks and
> > shifts in your head. It is basically just a shortcut and assists with
> > checking code against datasheets. Of course I would prefer to have access
> > through macros also but that was shot down so the code is now full of
> manual
> > shifts and ANDs. I hope that at least this small convenience will be
> > acceptable.
>
> 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),
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?

Thanks,
    Anton


> 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 the pitiful, multipage, connection-boxed form to which  the  flow-
> chart  has  today  been  elaborated, it has proved to be useless as a
> design tool -- programmers draw flowcharts after, not before, writing
> the programs they describe.                        - Fred Brooks, Jr.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list