diff mbox series

[6/7] minmax: Optimise _Static_assert() check in clamp()

Message ID 46f446f61c4f4304b756e38a19782ed9@AcuMS.aculab.com (mailing list archive)
State New
Headers show
Series minmax: reduce compilation time | expand

Commit Message

David Laight July 24, 2024, 2:32 p.m. UTC
Use __if_constexpr() instead of __builtin_choose_expr(__is_constexpr()).

Signed-off-by: David Laight <david.laight@aculab.com>
---
 include/linux/minmax.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index e250957036a1..2fb63efbeb0e 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -139,8 +139,7 @@ 
 	typeof(val) unique_val = (val);						\
 	typeof(lo) unique_lo = (lo);						\
 	typeof(hi) unique_hi = (hi);						\
-	_Static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)),	\
-			(lo) <= (hi), true),					\
+	_Static_assert(__if_constexpr((lo) <= (hi), (lo) <= (hi), true),		\
 		"clamp() low limit " #lo " greater than high limit " #hi);	\
 	_Static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error");	\
 	_Static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error");	\