Skip to contentSkip to conversation

x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p

PATCH In review Alexander Kuleshov 2 participants 2 messages Feb 26, 2016 – Feb 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/bitops.h: use IS_IMMEDIATE instead of dirrect call of __builtin_constant_p

The arch/x86/include/asm/bitops.h provides IS_IMMEDIATE macro which expands to the call of the __builtin_constant_p(). Let's use this macro in the test_bit() to be more clear.

---
 arch/x86/include/asm/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/bitops.h +1 -1
index cfe3b95..8cfbd2b 100644
@@ -333,7 +333,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
 #endif
 
 #define test_bit(nr, addr)			\
-	(__builtin_constant_p((nr))		\
+	(IS_IMMEDIATE((nr))			\
 	 ? constant_test_bit((nr), (addr))	\
 	 : variable_test_bit((nr), (addr)))
 
Signature · 1 line
2.7.2.335.g3476f70
#1 lore raw
Quoted 14 lines · Alexander Kuleshov

The arch/x86/include/asm/bitops.h provides IS_IMMEDIATE macro which expands to the call of the __builtin_constant_p(). Let's use this macro in the test_bit() to be more clear.

---
 arch/x86/include/asm/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/bitops.h +0 -0
index cfe3b95..8cfbd2b 100644

arch/x86/include/asm/bitops.h static int test_bit(int nr, const volatile unsigned long *addr); · line 338

Quoted 7 lines
arch/x86/include/asm/bitops.h +1 -1
@@ -333,7 +333,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
 #endif
 
 #define test_bit(nr, addr)			\
-	(__builtin_constant_p((nr))		\
+	(IS_IMMEDIATE((nr))			\
 	 ? constant_test_bit((nr), (addr))	\
 	 : variable_test_bit((nr), (addr)))

Why? In the kernel there's more than 200 uses of __builtin_constant_p(), while only 6 uses of IS_IMMEDIATE() ...

Thanks,

Ingo