From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net-next 2/6] bitmap: add a couple more helpers to work with arrays of u32s
Date: Thu, 20 Oct 2022 16:18:08 +0300 [thread overview]
Message-ID: <Y1FKkHEtc80wVWw3@smile.fi.intel.com> (raw)
In-Reply-To: <Y1CUbRA6hC6PO3IH@yury-laptop>
On Wed, Oct 19, 2022 at 05:21:01PM -0700, Yury Norov wrote:
> On Tue, Oct 18, 2022 at 04:00:23PM +0200, Alexander Lobakin wrote:
...
> > +static inline size_t bitmap_arr32_size(size_t nbits)
> > +{
> > + return array_size(BITS_TO_U32(nbits), sizeof(u32));
>
> To me this looks simpler: round_up(nbits, 32) / BITS_PER_BYTE.
> Can you check which generates better code?
It's not only about better code, but also about overflow protection, which your
proposal is missing.
> > +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-10-20 13:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 14:00 [PATCH v2 net-next 0/6] netlink: add universal 'bigint' attribute type Alexander Lobakin
2022-10-18 14:00 ` [PATCH v2 net-next 1/6] bitmap: try to optimize arr32 <-> bitmap on 64-bit LEs Alexander Lobakin
2022-10-18 22:41 ` Yury Norov
2022-10-19 15:21 ` Alexander Lobakin
2022-10-18 14:00 ` [PATCH v2 net-next 2/6] bitmap: add a couple more helpers to work with arrays of u32s Alexander Lobakin
2022-10-20 0:21 ` Yury Norov
2022-10-20 13:18 ` Andy Shevchenko [this message]
2022-10-20 15:31 ` Yury Norov
2022-10-18 14:00 ` [PATCH v2 net-next 3/6] lib/test_bitmap: verify intermediate arr32 when converting <-> bitmap Alexander Lobakin
2022-10-18 14:00 ` [PATCH v2 net-next 4/6] lib/test_bitmap: test the newly added arr32 functions Alexander Lobakin
2022-10-18 14:00 ` [PATCH v2 net-next 5/6] bitops: make BYTES_TO_BITS() treewide-available Alexander Lobakin
2022-10-18 19:55 ` Jakub Kicinski
2022-10-19 15:26 ` Alexander Lobakin
2022-10-18 14:00 ` [PATCH v2 net-next 6/6] netlink: add universal 'bigint' attribute type Alexander Lobakin
2022-10-18 14:13 ` Andy Shevchenko
2022-10-18 19:53 ` Jakub Kicinski
2022-10-19 15:34 ` Alexander Lobakin
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=Y1FKkHEtc80wVWw3@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexandr.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=maciej.fijalkowski@intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yury.norov@gmail.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;
as well as URLs for NNTP newsgroup(s).