Skip to content

Commit 71ee9b1

Browse files
david-laightakpm00
authored andcommitted
minmax.h: add whitespace around operators and after commas
Patch series "minmax.h: Cleanups and minor optimisations". Some tidyups and minor changes to minmax.h. This patch (of 7): Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: David Laight <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Jason A. Donenfeld <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Pedro Falcato <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e30ccbb commit 71ee9b1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

include/linux/minmax.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
* only need to be careful to not cause warnings for
5252
* pointer use.
5353
*/
54-
#define __signed_type_use(x,ux) (2+__is_nonneg(x,ux))
55-
#define __unsigned_type_use(x,ux) (1+2*(sizeof(ux)<4))
56-
#define __sign_use(x,ux) (is_signed_type(typeof(ux))? \
57-
__signed_type_use(x,ux):__unsigned_type_use(x,ux))
54+
#define __signed_type_use(x, ux) (2 + __is_nonneg(x, ux))
55+
#define __unsigned_type_use(x, ux) (1 + 2 * (sizeof(ux) < 4))
56+
#define __sign_use(x, ux) (is_signed_type(typeof(ux)) ? \
57+
__signed_type_use(x, ux) : __unsigned_type_use(x, ux))
5858

5959
/*
6060
* To avoid warnings about casting pointers to integers
@@ -74,15 +74,15 @@
7474
#ifdef CONFIG_64BIT
7575
#define __signed_type(ux) long
7676
#else
77-
#define __signed_type(ux) typeof(__builtin_choose_expr(sizeof(ux)>4,1LL,1L))
77+
#define __signed_type(ux) typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL, 1L))
7878
#endif
79-
#define __is_nonneg(x,ux) statically_true((__signed_type(ux))(x)>=0)
79+
#define __is_nonneg(x, ux) statically_true((__signed_type(ux))(x) >= 0)
8080

81-
#define __types_ok(x,y,ux,uy) \
82-
(__sign_use(x,ux) & __sign_use(y,uy))
81+
#define __types_ok(x, y, ux, uy) \
82+
(__sign_use(x, ux) & __sign_use(y, uy))
8383

84-
#define __types_ok3(x,y,z,ux,uy,uz) \
85-
(__sign_use(x,ux) & __sign_use(y,uy) & __sign_use(z,uz))
84+
#define __types_ok3(x, y, z, ux, uy, uz) \
85+
(__sign_use(x, ux) & __sign_use(y, uy) & __sign_use(z, uz))
8686

8787
#define __cmp_op_min <
8888
#define __cmp_op_max >
@@ -97,7 +97,7 @@
9797

9898
#define __careful_cmp_once(op, x, y, ux, uy) ({ \
9999
__auto_type ux = (x); __auto_type uy = (y); \
100-
BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy), \
100+
BUILD_BUG_ON_MSG(!__types_ok(x, y, ux, uy), \
101101
#op"("#x", "#y") signedness error"); \
102102
__cmp(op, ux, uy); })
103103

@@ -114,7 +114,7 @@
114114
static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \
115115
(lo) <= (hi), true), \
116116
"clamp() low limit " #lo " greater than high limit " #hi); \
117-
BUILD_BUG_ON_MSG(!__types_ok3(val,lo,hi,uval,ulo,uhi), \
117+
BUILD_BUG_ON_MSG(!__types_ok3(val, lo, hi, uval, ulo, uhi), \
118118
"clamp("#val", "#lo", "#hi") signedness error"); \
119119
__clamp(uval, ulo, uhi); })
120120

@@ -154,7 +154,7 @@
154154

155155
#define __careful_op3(op, x, y, z, ux, uy, uz) ({ \
156156
__auto_type ux = (x); __auto_type uy = (y);__auto_type uz = (z);\
157-
BUILD_BUG_ON_MSG(!__types_ok3(x,y,z,ux,uy,uz), \
157+
BUILD_BUG_ON_MSG(!__types_ok3(x, y, z, ux, uy, uz), \
158158
#op"3("#x", "#y", "#z") signedness error"); \
159159
__cmp(op, ux, __cmp(op, uy, uz)); })
160160

@@ -326,9 +326,9 @@ static inline bool in_range32(u32 val, u32 start, u32 len)
326326
* Use these carefully: no type checking, and uses the arguments
327327
* multiple times. Use for obvious constants only.
328328
*/
329-
#define MIN(a,b) __cmp(min,a,b)
330-
#define MAX(a,b) __cmp(max,a,b)
331-
#define MIN_T(type,a,b) __cmp(min,(type)(a),(type)(b))
332-
#define MAX_T(type,a,b) __cmp(max,(type)(a),(type)(b))
329+
#define MIN(a, b) __cmp(min, a, b)
330+
#define MAX(a, b) __cmp(max, a, b)
331+
#define MIN_T(type, a, b) __cmp(min, (type)(a), (type)(b))
332+
#define MAX_T(type, a, b) __cmp(max, (type)(a), (type)(b))
333333

334334
#endif /* _LINUX_MINMAX_H */

0 commit comments

Comments
 (0)