Linux wireless drivers development
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] bitfield: add FIELD_PREP_CONST()
Date: Wed, 18 Jan 2023 19:21:04 +0100	[thread overview]
Message-ID: <5ade37de-2582-9e80-b99f-01aab13d991c@intel.com> (raw)
In-Reply-To: <8b955e4d859aafdf42f1a11f37ddf2a5e47c2610.camel@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Wed, 18 Jan 2023 19:03:24 +0100

> On Wed, 2023-01-18 at 17:49 +0100, Alexander Lobakin wrote:
>>
>> Aaaah right. Seems like we can't avoid introducing a separate macro for
>> that. I like the idea of your patch anyways!
> 
> :)
> 
>> One note re __BF_CHECK_POW2(): can't we reuse is_power_of_2() anyhow?
>> Foe example, by deriving the code of the latter into a macro and then
>> using it in both?
>>
> 
> Well, not directly - for example is_power_of_2() doesn't accept 0, while
> we want to accept 0 (mask being e.g. "0xfull<<60", we already check for
> mask != 0).
> 
> I thought about __BUILD_BUG_ON_NOT_POWER_OF_2 but it uses BUILD_BUG_ON,
> not BUILD_BUG_ON_ZERO, and BUILD_BUG_ON is nicer in most contexts ...
> 
> So you could pull out the expression "((n) & ((n) - 1)) != 0" from all
> four of these, but it doesn't feel worth it.

Aaaah I see.

__BUILD_BUG_ON_NOT_POWER_OF_2_ZERO() then? :D

(mostly joking and not sure it's worth it, up to you)

> 
> johannes

Thanks,
Olek

  reply	other threads:[~2023-01-18 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 13:26 [PATCH] bitfield: add FIELD_PREP_CONST() Johannes Berg
2023-01-18 16:10 ` Alexander Lobakin
2023-01-18 16:22   ` Johannes Berg
2023-01-18 16:49     ` Alexander Lobakin
2023-01-18 18:03       ` Johannes Berg
2023-01-18 18:21         ` Alexander Lobakin [this message]
2023-01-18 19:41           ` Johannes Berg

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=5ade37de-2582-9e80-b99f-01aab13d991c@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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