2 * transsip - the telephony network
3 * By Daniel Borkmann <daniel@transsip.org>
4 * Copyright 2011, 2012 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
5 * Swiss federal institute of technology (ETH Zurich)
6 * Subject to the GPL, version 2.
13 # define __aligned_16 __attribute__((aligned(16)))
17 # define likely(x) __builtin_expect(!!(x), 1)
21 # define unlikely(x) __builtin_expect(!!(x), 0)
25 # define __extension__
29 # define __deprecated /* unimplemented */
33 # define __read_mostly __attribute__((__section__(".data.read_mostly")))
36 #ifndef __always_inline
37 # define __always_inline inline
41 # define __hidden __attribute__((visibility("hidden")))
46 # define array_size(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
49 #ifndef __must_be_array
50 # define __must_be_array(x) \
51 build_bug_on_zero(__builtin_types_compatible_p(typeof(x), typeof(&x[0])))
57 typeof (a) _a = (a); \
58 typeof (b) _b = (b); \
66 typeof (a) _a = (a); \
67 typeof (b) _b = (b); \
72 #define anon(return_type, body_and_args) \
74 return_type __fn__ body_and_args \
81 * qsort(&argv[1], argc - 1, sizeof(argv[1]),
82 * anon(int, (const void * a, const void * b) {
83 * return strcmp(*(char * const *) a, *(char * const *) b);
88 # define bug() __builtin_trap()
91 #ifndef build_bug_on_zero
92 # define build_bug_on_zero(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
95 #endif /* BUILT_IN_H */