reenabled stun probe
[transsip.git] / src / built-in.h
blob14d826809ed551820ae199cc512df6d4e6ee9537
1 #ifndef BUILT_IN_H
2 #define BUILT_IN_H
4 #ifndef __aligned_16
5 # define __aligned_16 __attribute__((aligned(16)))
6 #endif
8 #ifndef likely
9 # define likely(x) __builtin_expect(!!(x), 1)
10 #endif
12 #ifndef unlikely
13 # define unlikely(x) __builtin_expect(!!(x), 0)
14 #endif
16 #ifndef __extension__
17 # define __extension__
18 #endif
20 #ifndef __deprecated
21 # define __deprecated /* unimplemented */
22 #endif
24 #ifndef __read_mostly
25 # define __read_mostly __attribute__((__section__(".data.read_mostly")))
26 #endif
28 #ifndef __always_inline
29 # define __always_inline inline
30 #endif
32 #ifndef __hidden
33 # define __hidden __attribute__((visibility("hidden")))
34 #endif
36 #ifndef array_size
37 # define array_size(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
38 #endif
40 #ifndef __must_be_array
41 # define __must_be_array(x) \
42 build_bug_on_zero(__builtin_types_compatible_p(typeof(x), typeof(&x[0])))
43 #endif
45 #ifndef max
46 # define max(a, b) \
47 ({ \
48 typeof (a) _a = (a); \
49 typeof (b) _b = (b); \
50 _a > _b ? _a : _b; \
52 #endif
54 #ifndef min
55 # define min(a, b) \
56 ({ \
57 typeof (a) _a = (a); \
58 typeof (b) _b = (b); \
59 _a < _b ? _a : _b; \
61 #endif
63 #ifndef bug
64 # define bug() __builtin_trap()
65 #endif
67 #ifndef build_bug_on_zero
68 # define build_bug_on_zero(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
69 #endif
71 #endif /* BUILT_IN_H */