Lines Matching +full:2 +full:- +full:dimensional
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
14 * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0)
15 * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0)
19 * the type_max expression (but not if -fsanitize=undefined is in
25 * a-feature-not-a-bug, since people shouldn't be doing arithmetic on
30 * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html -
33 #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
34 #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
35 #define type_min(T) ((T)((T)-type_max(T)-(T)1))
38 * Avoids triggering -Wtype-limits compilation warning,
46 * both the type-agnostic benefits of the macros while also being able to
55 * check_add_overflow() - Calculate addition with overflow checking
63 * "safe for use" on a non-zero return value, which indicates that the
70 * check_sub_overflow() - Calculate subtraction with overflow checking
78 * "safe for use" on a non-zero return value, which indicates that the
85 * check_mul_overflow() - Calculate multiplication with overflow checking
93 * considered "safe for use" on a non-zero return value, which indicates
100 * check_shl_overflow() - Calculate a left-shifted value and check overflow
110 * - '@a << @s' causes bits to be lost when stored in *@d.
111 * - '@s' is garbage (e.g. negative) or so large that the result of
113 * - '@a' is negative.
114 * - '@a << @s' sets the sign bit, if any, in '*@d'.
132 * size_mul() - Calculate size_t multiplication with saturation at SIZE_MAX
151 * size_add() - Calculate size_t addition with saturation at SIZE_MAX
170 * size_sub() - Calculate size_t subtraction with saturation at SIZE_MAX
174 * Returns: calculate @minuend - @subtrahend, both promoted to size_t,
192 * array_size() - Calculate size of 2-dimensional array.
196 * Calculates size of 2-dimensional array: @a * @b.
204 * array3_size() - Calculate size of 3-dimensional array.
209 * Calculates size of 3-dimensional array: @a * @b * @c.
217 * flex_array_size() - Calculate size of a flexible array member
230 (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
231 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
234 * struct_size() - Calculate size of structure with trailing flexible array.