On Mon, Aug 18, 2025 at 03:49 PM -07, Eduard Zingerman wrote: > 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. Makes sense if I think about it like that. Thanks.