![]() * * Return: number of bytes needed or SIZE_MAX on overflow. * * Calculates size of memory needed for structure followed by an * array of number of elements. */ #define flex_array_size(p, member, count) \ _builtin_choose_expr( _is_constexpr(count), \ (count) * sizeof(*(p)-> member) _must_be_array((p)-> member), \ size_mul(count, sizeof(*(p)-> member) _must_be_array((p)-> member))) /** * struct_size() - Calculate size of structure with trailing flexible array. * * Calculates size of a flexible array of number of * elements, at the end of structure * * Return: number of bytes needed or SIZE_MAX on overflow. Note: The overflow property only works for block elements with a specified height. This property specifies whether to clip content or to add scrollbars when an element's content is too big to fit in a specified area. */ #define arra圓_size(a, b, c) size_mul( size_mul(a, b), c) /** * flex_array_size() - Calculate size of a flexible array member * within an enclosing structure. The overflow property specifies what should happen if content overflows an element's box. * * dimension one * dimension two * dimension three * * Calculates size of 3-dimensional array: * * * * Returns: number of bytes needed to represent the array or SIZE_MAX on * overflow. Whereas if you set the overflow value to hidden, the image will cut off at 200px. That image will stick out of the div and be visible by default. */ #define array_size(a, b) size_mul(a, b) /** * arra圓_size() - Calculate size of 3-dimensional array. The overflow property controls what happens to content that breaks outside of its bounds: imagine a div in which you’ve explicitly set to be 200px wide, but contains an image that is 300px wide. * * dimension one * dimension two * * Calculates size of 2-dimensional array: * * * Returns: number of bytes needed to represent the array or SIZE_MAX on * overflow. */ static inline bool _must_check _must_check_overflow ( bool overflow ) /** * array_size() - Calculate size of 2-dimensional array. It would seem more obvious * to do something like: * * #define type_min(T) (T)(is_signed_type(T) ? (T)1 0 || (a) = 0) #define is_negative(a) (!( is_non_negative(a))) /* * Allows for effectively applying _must_check to a macro so we can have * both the type-agnostic benefits of the macros while also being able to * enforce that the return value is, in fact, checked. Engineers should help solve the hardest questions, the unknowns, where being familiar with how the product was built is essential. Not only for developers to solve problems, it’s also enabled our sales field to answer technical questions that help them close deals. hpp unambiguously identifies it as C header file, and works well in actual practice. Using no extension communicates nothing and forces inspection of file contents to determine type. ![]() These macros may also be useful elsewhere. Stack Overflow for Teams has been a resource for our entire company. h extension is used for C header files, and therefore communicates the wrong thing about C header files. * SPDX-License-Identifier: GPL-2.0 OR MIT */ #ifndef _LINUX_OVERFLOW_H #define _LINUX_OVERFLOW_H #include #include #include /* * We need to compute the minimum and maximum values representable in a given * type.
0 Comments
Leave a Reply. |