Skip to contentSkip to conversation

bad definition of cpus_complement

PATCH In review Joe Korty 3 participants 3 messages Aug 28, 2003

lore
Share & tools
lore

Joe Korty

author
#0 lore raw

PATCH 1/1 bad definition of cpus_complement

One of the definitions of cpus_complement is broke. Also, cpus_complement is the only cpus_* definition which operates in-place rather than in (dst,src) form. I will submit a patch to convert if there is interest.

Joe

asm-generic/cpumask_up.h renamed from asm-generic/cpumask_up.h.orig +1 -1
@@ -28,7 +28,7 @@
 
 #define cpus_complement(map)						\
 	do {								\
-		cpus_coerce(map) = !cpus_coerce(map);			\
+		cpus_coerce(map) = ~cpus_coerce(map);			\
 	} while (0)
 
 #define cpus_equal(map1, map2)		(cpus_coerce(map1) == cpus_coerce(map2))
#1 lore raw
Quoted 9 lines · Joe Korty

One of the definitions of cpus_complement is broke. Also, cpus_complement is the only cpus_* definition which operates in-place rather than in (dst,src) form. I will submit a patch to convert if there is interest.

Joe

asm-generic/cpumask_up.h line 32

Quoted 6 lines
asm-generic/cpumask_up.h renamed from asm-generic/cpumask_up.h.orig +1 -1
@@ -28,7 +28,7 @@
 
 #define cpus_complement(map)						\
 	do {								\
-		cpus_coerce(map) = !cpus_coerce(map);			\
+		cpus_coerce(map) = ~cpus_coerce(map);			\
 	} while (0)

Broken how? The value range for a cpumask_t on UP is [0,1], and ! respects that whereas ~ does not.

#2 lore raw
In reply to Joe Korty
Quoted 3 lines · Joe Korty

One of the definitions of cpus_complement is broke. Also, cpus_complement is the only cpus_* definition which operates in-place rather than in (dst,src) form. I will submit a patch to convert if there is interest.

The definition is fine (see other responses), but the inconsistent argument convention might be worth shoring up to match the others.

-- wli