Am 28.03.2016 um 09:23 schrieb Marcel Apfelbaum: > Fix 'error: shift exponent -1 is negative' warning > by adding a corresponding assert. > > Reported-by: Peter Maydell <peter.mayd...@linaro.org> > Signed-off-by: Markus Armbruster <arm...@redhat.com> > Signed-off-by: Marcel Apfelbaum <mar...@redhat.com> > --- > hw/pci/pci.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index e67664d..a1d41aa 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -163,11 +163,15 @@ int pci_bar(PCIDevice *d, int reg) > > static inline int pci_irq_state(PCIDevice *d, int irq_num) > { > + assert(irq_num >= 0); > + > return (d->irq_state >> irq_num) & 0x1; > } > > static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) > { > + assert(irq_num >= 0); > + > d->irq_state &= ~(0x1 << irq_num); > d->irq_state |= level << irq_num; > }
Do we use negative values for irq_num anywhere? If not, using an unsigned irq_num might be a better solution. Stefan
signature.asc
Description: OpenPGP digital signature