Lines Matching +full:left +full:- +full:shifted

1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
13 * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0)
14 * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0)
18 * the type_max expression (but not if -fsanitize=undefined is in
24 * a-feature-not-a-bug, since people shouldn't be doing arithmetic on
29 * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html -
32 #define is_signed_type(type) (((type)(-1)) < (type)1)
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
57 * macros), whereas gcc's type-generic overflow checkers accept
89 /** check_shl_overflow() - Calculate a left-shifted value and check overflow
91 * @a: Value to be shifted
92 * @s: How many bits left to shift
99 * - 'a << s' causes bits to be lost when stored in *d.
100 * - 's' is garbage (e.g. negative) or so large that the result of
102 * - 'a' is negative.
103 * - 'a << s' sets the sign bit, if any, in '*d'.
121 * array_size() - Calculate size of 2-dimensional array.
126 * Calculates size of 2-dimensional array: @a * @b.
142 * array3_size() - Calculate size of 3-dimensional array.
148 * Calculates size of 3-dimensional array: @a * @b * @c.
182 * struct_size() - Calculate size of structure with trailing array.
194 sizeof(*(p)->member) + __must_be_array((p)->member),\
198 * flex_array_size() - Calculate size of a flexible array member
212 sizeof(*(p)->member) + __must_be_array((p)->member))