ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski at intel.com>
To: ell at lists.01.org
Subject: Re: [PATCH 01/11] net: Add l_net_subnet_matches
Date: Mon, 18 Apr 2022 19:01:14 +0200	[thread overview]
Message-ID: <CAOq732JYG1Ld4OLboAvWGZZYbT=sQNB4xPTnvbzWYTJM3RXsGw@mail.gmail.com> (raw)
In-Reply-To: 04db266e-cc38-0832-b19f-d9f8c22a1c56@gmail.com

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

Hi Denis,

On Mon, 18 Apr 2022 at 18:34, Denis Kenzior <denkenz(a)gmail.com> wrote:
> > +     return !bits ||
> > +             ((((const uint8_t *) a)[bytes] ^ ((const uint8_t *) b)[bytes]) &
> > +              (0xff00u >> bits)) == 0;
>
> There were a bit too many '()' for my liking.  I moved the casts to the variable
> declaration block above which ended up being the same number of lines and looked
> a bit cleaner.

Do we want to do the array[bytes] access after the !bits check to
avoid accessing the byte after the end of the address for weird cases
where the prefix_len is exactly the number of bits in the two buffers
we received.

Best regards

             reply	other threads:[~2022-04-18 17:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 17:01 Andrew Zaborowski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-21 11:02 [PATCH 01/11] net: Add l_net_subnet_matches Andrew Zaborowski
2022-04-21  2:36 Denis Kenzior
2022-04-20 22:34 Andrew Zaborowski
2022-04-19 20:12 Denis Kenzior
2022-04-19 18:48 Andrew Zaborowski
2022-04-19 15:02 Denis Kenzior
2022-04-19  7:42 Andrew Zaborowski
2022-04-18 17:59 Denis Kenzior
2022-04-18 17:21 Andrew Zaborowski
2022-04-18 17:04 Denis Kenzior
2022-04-18 16:34 Denis Kenzior
2022-04-11 14:20 Andrew Zaborowski

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='CAOq732JYG1Ld4OLboAvWGZZYbT=sQNB4xPTnvbzWYTJM3RXsGw@mail.gmail.com' \
    --to=ell@lists.linux.dev \
    /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).