Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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/c50365d214e04f9ba256d417c8bebbc0@AcuMS.aculab.com
Link: https://lkml.kernel.org/r/f04b2e1310244f62826267346fde0553@AcuMS.aculab.com
Signed-off-by: David Laight <david.laight@aculab.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Laight and committed by
Andrew Morton
71ee9b16 e30ccbb9

+17 -17
+17 -17
include/linux/minmax.h
··· 51 51 * only need to be careful to not cause warnings for 52 52 * pointer use. 53 53 */ 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)) 58 58 59 59 /* 60 60 * To avoid warnings about casting pointers to integers ··· 74 74 #ifdef CONFIG_64BIT 75 75 #define __signed_type(ux) long 76 76 #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)) 78 78 #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) 80 80 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)) 83 83 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)) 86 86 87 87 #define __cmp_op_min < 88 88 #define __cmp_op_max > ··· 97 97 98 98 #define __careful_cmp_once(op, x, y, ux, uy) ({ \ 99 99 __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), \ 101 101 #op"("#x", "#y") signedness error"); \ 102 102 __cmp(op, ux, uy); }) 103 103 ··· 114 114 static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \ 115 115 (lo) <= (hi), true), \ 116 116 "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), \ 118 118 "clamp("#val", "#lo", "#hi") signedness error"); \ 119 119 __clamp(uval, ulo, uhi); }) 120 120 ··· 154 154 155 155 #define __careful_op3(op, x, y, z, ux, uy, uz) ({ \ 156 156 __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), \ 158 158 #op"3("#x", "#y", "#z") signedness error"); \ 159 159 __cmp(op, ux, __cmp(op, uy, uz)); }) 160 160 ··· 326 326 * Use these carefully: no type checking, and uses the arguments 327 327 * multiple times. Use for obvious constants only. 328 328 */ 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)) 333 333 334 334 #endif /* _LINUX_MINMAX_H */