Skip to content

Commit 4463a44

Browse files
vincent-mailholYuryNorov
authored andcommitted
linux/bits.h: simplify GENMASK_INPUT_CHECK()
In GENMASK_INPUT_CHECK(), __builtin_choose_expr(__is_constexpr((l) > (h)), (l) > (h), 0) is the exact expansion of: const_true((l) > (h)) Apply const_true() to simplify GENMASK_INPUT_CHECK(). CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Rasmus Villemoes <linux@rasmusvillemoes.dk> CC: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Reviewed-by: Yury Norov <yury.norov@gmail.com>, Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Yury Norov <yury.norov@gmail.com>
1 parent 4f3d1be commit 4463a44

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

include/linux/bits.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
*/
2121
#if !defined(__ASSEMBLY__)
2222
#include <linux/build_bug.h>
23-
#define GENMASK_INPUT_CHECK(h, l) \
24-
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
25-
__is_constexpr((l) > (h)), (l) > (h), 0)))
23+
#include <linux/compiler.h>
24+
#define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
2625
#else
2726
/*
2827
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,

0 commit comments

Comments
 (0)