From: Eduard Zingerman <eddyz87@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>,
Nandakumar Edamana <nandakumar@nandakumar.co.in>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next] bpf: improve the general precision of tnum_mul
Date: Mon, 18 Aug 2025 15:49:59 -0700 [thread overview]
Message-ID: <7ac103b171a8b5ccfffff08e4cf201152d2134d4.camel@gmail.com> (raw)
In-Reply-To: <87tt24zdy4.fsf@cloudflare.com>
On Mon, 2025-08-18 at 20:23 +0200, Jakub Sitnicki wrote:
> On Fri, Aug 15, 2025 at 07:35 PM +0530, Nandakumar Edamana wrote:
>
> [...]
>
> > @@ -155,6 +163,14 @@ struct tnum tnum_intersect(struct tnum a, struct tnum b)
> > return TNUM(v & ~mu, mu);
> > }
> >
> > +struct tnum tnum_union(struct tnum a, struct tnum b)
> > +{
> > + u64 v = a.value & b.value;
> > + u64 mu = (a.value ^ b.value) | a.mask | b.mask;
> > +
> > + return TNUM(v & ~mu, mu);
> > +}
> > +
>
> Not sure I follow. So if I have two tnums that represent known contants,
> say a=(v=0b1010, m=0) and b=(v=0b0101, m=0), then their union is an
> unknown u=(v=0b0000, m=0b1111)?
Yes, because a and b have no bits in common.
As far as I understand, tnum_union() computes a tnum that is a
superset of both `a` and `b`. Maybe `union` is not the best name.
next prev parent reply other threads:[~2025-08-18 22:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 14:05 [PATCH v2 bpf-next] bpf: improve the general precision of tnum_mul Nandakumar Edamana
2025-08-15 19:10 ` Eduard Zingerman
2025-08-16 4:58 ` Nandakumar Edamana
2025-08-18 22:16 ` Eduard Zingerman
2025-08-18 22:47 ` Eduard Zingerman
2025-08-18 14:24 ` Daniel Borkmann
2025-08-20 6:15 ` Harishankar Vishwanathan
[not found] ` <0ba41cd7-adc0-4c65-b1e0-defd8ebc2d64@nandakumar.co.in>
2025-08-20 7:48 ` Fwd: " Nandakumar Edamana
2025-08-21 5:46 ` Harishankar Vishwanathan
2025-08-20 10:31 ` Nandakumar Edamana
2025-08-18 18:23 ` Jakub Sitnicki
2025-08-18 22:49 ` Eduard Zingerman [this message]
2025-08-19 9:20 ` Jakub Sitnicki
2025-08-29 4:04 ` Shung-Hsi Yu
2025-08-18 23:14 ` Eduard Zingerman
[not found] ` <3b7b2ed1-bce1-49da-b83c-2ca46850062c@nandakumar.co.in>
2025-08-18 23:31 ` Eduard Zingerman
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=7ac103b171a8b5ccfffff08e4cf201152d2134d4.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jakub@cloudflare.com \
--cc=nandakumar@nandakumar.co.in \
/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).