mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Frias <sf84@laposte.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: zijun_hu <zijun_hu@htc.com>, Sasha Levin <sasha.levin@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mason <slash.tmp@free.fr>,
	Maxime Coquelin <maxime.coquelin@st.com>,
	Harvey Harrison <harvey.harrison@gmail.com>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields
Date: Mon, 5 Dec 2016 18:47:38 +0100	[thread overview]
Message-ID: <1041cd17-5e96-61cf-16b3-82cf4d52101d@laposte.net> (raw)
In-Reply-To: <CA+55aFyyiRjAhGGK_6Ap21zY+NRttQZGjdxpR9_DzA5X7cGobw@mail.gmail.com>

On 05/12/16 18:13, Linus Torvalds wrote:
> On Mon, Dec 5, 2016 at 5:36 AM, Sebastian Frias <sf84@laposte.net> wrote:
>> Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with
>> continuous bitfields, just as BIT(x) does for single bits.
>>
>> SETBITFIELD_ULL(msb, lsb, value) macro is also added.
> 
> No. No, no, no.
> 
> Didn't we have this discussion already? Or was that for one of the
> other silly naming things?
> 
> That thing doesn't "SET" anything at all. It generates a value, nothing more.
> 
> So the name is completely unacceptable. It follows the convention of
> GENMASK, so maybe GENVALUE?
> 

Thanks for your input.
I was looking for suggestions on the name, thanks for yours, I will submit
a v2 with the name changed as you proposed.

> I also absolutely hate the stupid "big bit first" idiocy, but we did
> that for GENMASK too, so I guess we're stuck with that retarded model.
> 

Yes, I followed the same convention.

> Yes, I understand why it happened - people look at register definition
> graphics, and the high bits are to the left.
> 
> But when you then read the documentation, it will still say things
> like "bits 9 through 12 contain the value XYZ", because while
> individual numbers are written MSB first, we actuall _read_ left to
> right. You'd never give a range as "12 to 5", you'd say "5 to 12".
> 
>            Linus
> 

  reply	other threads:[~2016-12-05 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 13:36 Sebastian Frias
2016-12-05 15:34 ` Borislav Petkov
2016-12-05 17:02   ` Sebastian Frias
2016-12-05 17:13 ` Linus Torvalds
2016-12-05 17:47   ` Sebastian Frias [this message]
2016-12-05 17:48 ` Geert Uytterhoeven
2016-12-06 10:31   ` Sebastian Frias
2016-12-06 10:42     ` Geert Uytterhoeven
2016-12-06 11:03       ` Sebastian Frias
2016-12-06 11:12         ` Geert Uytterhoeven
2016-12-06 14:56           ` Sebastian Frias
2016-12-07  8:34 ` Kalle Valo

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=1041cd17-5e96-61cf-16b3-82cf4d52101d@laposte.net \
    --to=sf84@laposte.net \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=sasha.levin@oracle.com \
    --cc=slash.tmp@free.fr \
    --cc=torvalds@linux-foundation.org \
    --cc=zijun_hu@htc.com \
    /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

all inboxes | Powered by JetHome®