From b08b678a16be5e054f0c36b3b5b1338827811c65 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Fri, 29 Aug 2014 12:21:49 +0200 Subject: [PATCH] thread: Use explicit wide type when shifting > 32 bits Without the explicit wide type, the shift operation may be performed on a int which will result in implementation defined behaviour on a system with more than 32 CPUs. Signed-off-by: Thomas Graf Signed-off-by: Ben Pfaff --- lib/ovs-thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 176f434d9..529756f1d 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -510,11 +510,11 @@ parse_cpuinfo(long int *n_cores) break; } - if (cpu & (1 << id)) { + if (cpu & (1ULL << id)) { /* We've already counted this package's cores. */ continue; } - cpu |= 1 << id; + cpu |= 1ULL << id; /* Find the number of cores for this package. */ while (fgets(line, sizeof line, stream)) { -- 2.20.1