 |
Blender V4.3
|
Go to the documentation of this file.
21# define LIKELY(x) __builtin_expect(!!(x), 1)
22# define UNLIKELY(x) __builtin_expect(!!(x), 0)
25# define UNLIKELY(x) (x)
35#define UNPACK2(a) ((a)[0]), ((a)[1])
36#define UNPACK3(a) UNPACK2(a), ((a)[2])
37#define UNPACK4(a) UNPACK3(a), ((a)[3])
39#define UNPACK2_EX(pre, a, post) (pre((a)[0]) post), (pre((a)[1]) post)
40#define UNPACK3_EX(pre, a, post) UNPACK2_EX(pre, a, post), (pre((a)[2]) post)
41#define UNPACK4_EX(pre, a, post) UNPACK3_EX(pre, a, post), (pre((a)[3]) post)
50#if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__) && !defined(__INTEL_COMPILER)
51# define ARRAY_SIZE(arr) \
52 ((sizeof(struct { int isnt_array : ((const void *)&(arr) == &(arr)[0]); }) * 0) + \
53 (sizeof(arr) / sizeof(*(arr))))
55# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr)))
69#define _VA_ELEM2(v, a) ((v) == (a))
70#define _VA_ELEM3(v, a, b) \
71 (_VA_ELEM2(v, a) || _VA_ELEM2(v, b))
72#define _VA_ELEM4(v, a, b, c) \
73 (_VA_ELEM3(v, a, b) || _VA_ELEM2(v, c))
74#define _VA_ELEM5(v, a, b, c, d) \
75 (_VA_ELEM4(v, a, b, c) || _VA_ELEM2(v, d))
76#define _VA_ELEM6(v, a, b, c, d, e) \
77 (_VA_ELEM5(v, a, b, c, d) || _VA_ELEM2(v, e))
78#define _VA_ELEM7(v, a, b, c, d, e, f) \
79 (_VA_ELEM6(v, a, b, c, d, e) || _VA_ELEM2(v, f))
80#define _VA_ELEM8(v, a, b, c, d, e, f, g) \
81 (_VA_ELEM7(v, a, b, c, d, e, f) || _VA_ELEM2(v, g))
82#define _VA_ELEM9(v, a, b, c, d, e, f, g, h) \
83 (_VA_ELEM8(v, a, b, c, d, e, f, g) || _VA_ELEM2(v, h))
84#define _VA_ELEM10(v, a, b, c, d, e, f, g, h, i) \
85 (_VA_ELEM9(v, a, b, c, d, e, f, g, h) || _VA_ELEM2(v, i))
86#define _VA_ELEM11(v, a, b, c, d, e, f, g, h, i, j) \
87 (_VA_ELEM10(v, a, b, c, d, e, f, g, h, i) || _VA_ELEM2(v, j))
88#define _VA_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) \
89 (_VA_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || _VA_ELEM2(v, k))
90#define _VA_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) \
91 (_VA_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || _VA_ELEM2(v, l))
92#define _VA_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) \
93 (_VA_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || _VA_ELEM2(v, m))
94#define _VA_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
95 (_VA_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || _VA_ELEM2(v, n))
96#define _VA_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \
97 (_VA_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || _VA_ELEM2(v, o))
98#define _VA_ELEM17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
99 (_VA_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || _VA_ELEM2(v, p))
103#define ELEM(...) VA_NARGS_CALL_OVERLOAD(_VA_ELEM, __VA_ARGS__)
117#define STRINGIFY_ARG(x) "" #x
118#define STRINGIFY_APPEND(a, b) "" a #b
119#define STRINGIFY(x) STRINGIFY_APPEND("", x)
123# define strcasecmp _stricmp
124# define strncasecmp _strnicmp
127#define STREQ(a, b) (strcmp(a, b) == 0)
128#define STRCASEEQ(a, b) (strcasecmp(a, b) == 0)
129#define STREQLEN(a, b, n) (strncmp(a, b, n) == 0)
130#define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0)
132#define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0)