Lines Matching +full:value +full:- +full:start

1 /* SPDX-License-Identifier: GPL-2.0 */
11 * - avoid multiple evaluations of the arguments (so side-effects like
12 * "x++" happen only once) when non-constant.
13 * - perform strict type-checking (to generate warnings instead of
16 * - retain result as a constant expressions when called with only
64 * min - return minimum of two values of the same or compatible types
65 * @x: first value
66 * @y: second value
71 * max - return maximum of two values of the same or compatible types
72 * @x: first value
73 * @y: second value
78 * min3 - return minimum of three values
79 * @x: first value
80 * @y: second value
81 * @z: third value
86 * max3 - return maximum of three values
87 * @x: first value
88 * @y: second value
89 * @z: third value
94 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
104 * clamp - return a value clamped to a given range with strict typechecking
105 * @val: current value
106 * @lo: lowest allowable value
107 * @hi: highest allowable value
122 * min_t - return minimum of two values, using the specified type
124 * @x: first value
125 * @y: second value
130 * max_t - return maximum of two values, using the specified type
132 * @x: first value
133 * @y: second value
139 * _Generic(foo, type-name: association, ..., default: association) performs a
141 * Do not use the const keyword in the type-name as it will not match the
160 * In the following legit use-case where the "array" passed is a simple pointer,
162 * --- 8< ---
166 * --- 8< ---
178 __unconst_integer_typeof(__array[0]) __element = __array[--__len]; \
179 while (__len--) \
184 * min_array - return minimum of values present in an array
193 * max_array - return maximum of values present in an array
202 * clamp_t - return a value clamped to a given range using a given type
204 * @val: current value
205 * @lo: minimum allowable value
206 * @hi: maximum allowable value
214 * clamp_val - return a value clamped to a given range using val's type
215 * @val: current value
216 * @lo: minimum allowable value
217 * @hi: maximum allowable value
226 static inline bool in_range64(u64 val, u64 start, u64 len) in in_range64() argument
228 return (val - start) < len; in in_range64()
231 static inline bool in_range32(u32 val, u32 start, u32 len) in in_range32() argument
233 return (val - start) < len; in in_range32()
237 * in_range - Determine if a value lies within a range.
238 * @val: Value to test.
239 * @start: First value in range.
242 * This is more efficient than "if (start <= val && val < (start + len))".
243 * It also gives a different answer if @start + @len overflows the size of
245 * which behaviour you want, or prove that start + len never overflow.
248 #define in_range(val, start, len) \ argument
249 ((sizeof(start) | sizeof(len) | sizeof(val)) <= sizeof(u32) ? \
250 in_range32(val, start, len) : in_range64(val, start, len))
253 * swap - swap values of @a and @b
254 * @a: first value
255 * @b: second value