mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Frias <sf84@laposte.net>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: zijun_hu <zijun_hu@htc.com>, Sasha Levin <sasha.levin@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.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: Tue, 6 Dec 2016 11:31:36 +0100	[thread overview]
Message-ID: <55a33378-e235-08da-251e-fff432be72fb@laposte.net> (raw)
In-Reply-To: <CAMuHMdWBBFS1HZGoaixakFEOTPyWtp6dsOeYi3UFNKT7f00a3w@mail.gmail.com>

On 05/12/16 18:48, Geert Uytterhoeven wrote:
> On Mon, Dec 5, 2016 at 2:36 PM, 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.
> 
> If it's a bitfield, why not calling it that way?
> 

I don't know if you saw v2 (or v3 for that matter), but the name was changed
to GENVALUE.
Also a small use case was added to the commit message:

"Introduce GENVALUE(msb, lsb, value) macro..."
"...This is useful mostly for creating values to be packed together
via OR operations, ex:

   u32 val = 0x11110000;
   val |= GENVALUE(19, 12, 0x5a);

now 'val = 0x1115a000'"

> So what about BITFIELD(start ,size), like arch/tile/kernel/tile-desc_32.c has?
> 
>> SETBITFIELD_ULL(msb, lsb, value) macro is also added.
> 
> Confused by the need for a "value" parameter...

"value" is the value to be massaged (shifted, masked) into a [msb:lsb] bitfield.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 

  reply	other threads:[~2016-12-06 10:31 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
2016-12-05 17:48 ` Geert Uytterhoeven
2016-12-06 10:31   ` Sebastian Frias [this message]
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=55a33378-e235-08da-251e-fff432be72fb@laposte.net \
    --to=sf84@laposte.net \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=geert@linux-m68k.org \
    --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®