[PATCH libpciaccess] linux: support 32 bit PCI domains (v3)

Stephen Hemminger stephen at networkplumber.org
Wed Sep 20 20:13:06 UTC 2017


On Wed, 20 Sep 2017 13:31:17 -0400
Adam Jackson <ajax at redhat.com> wrote:

> On Mon, 2017-09-18 at 21:33 +0100, Emil Velikov wrote:
> > Hi Adam,
> > 
> > A couple of question about the v3 changes. Hope I'm not loosing my marbles.
> > 
> > On 18 September 2017 at 18:17, Adam Jackson <ajax at redhat.com> wrote:
> >   
> > > --- a/src/netbsd_pci.c
> > > +++ b/src/netbsd_pci.c
> > > @@ -959,6 +959,10 @@ pci_system_netbsd_create(void)
> > >                                         continue;
> > > 
> > >                                 device->base.domain = domain;
> > > +                               if (domain > 0xffff)
> > > +                                   device->base.domain_16 = 0xffff;
> > > +                               else
> > > +                                   device->base.domain_16 = domain & 0xffff;  
> > 
> > In the else case domain is within [0..0xffff] thus the "& 0xffff" is a
> > noop. Right?  
> 
> Yeah, pretty sure I just typed that without thinking to be clear that
> it was being clamped, any remotely reasonable compiler is going to
> optimize it out of existence.
> 
> - ajax

Not only that since domain_16 is a uint16_t compiler would have to fold it
no matter the value.


More information about the xorg-devel mailing list