summaryrefslogtreecommitdiffstats
path: root/hw/intc
diff options
context:
space:
mode:
authorPeter Maydell2014-03-17 17:00:31 +0100
committerMichael Tokarev2014-03-27 16:22:49 +0100
commit6d55574a656f3a533a370156aaefedcf7980d4d8 (patch)
treee9f4acac0a53b35d13e05dfce5c0471981f80baf /hw/intc
parenttarget-i386: Avoid shifting left into sign bit (diff)
downloadqemu-6d55574a656f3a533a370156aaefedcf7980d4d8.tar.gz
qemu-6d55574a656f3a533a370156aaefedcf7980d4d8.tar.xz
qemu-6d55574a656f3a533a370156aaefedcf7980d4d8.zip
hw/intc/apic.c: Use uint32_t for mask word in foreach_apic
Use unsigned arithmetic for operations on the mask word in the foreach_apic() macro, to avoid relying on undefined behaviour when shifting into the sign bit. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/apic.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 361ae90b65..b8c061bdaa 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -201,12 +201,12 @@ static void apic_external_nmi(APICCommonState *s)
#define foreach_apic(apic, deliver_bitmask, code) \
{\
- int __i, __j, __mask;\
+ int __i, __j;\
for(__i = 0; __i < MAX_APIC_WORDS; __i++) {\
- __mask = deliver_bitmask[__i];\
+ uint32_t __mask = deliver_bitmask[__i];\
if (__mask) {\
for(__j = 0; __j < 32; __j++) {\
- if (__mask & (1 << __j)) {\
+ if (__mask & (1U << __j)) {\
apic = local_apics[__i * 32 + __j];\
if (apic) {\
code;\