… | |
… | |
81 | # define ecb_decltype(x) __decltype(x) |
81 | # define ecb_decltype(x) __decltype(x) |
82 | #elif ECB_GCC_VERSION(3,0) |
82 | #elif ECB_GCC_VERSION(3,0) |
83 | # define ecb_decltype(x) typeof(x) |
83 | # define ecb_decltype(x) typeof(x) |
84 | #endif |
84 | #endif |
85 | |
85 | |
|
|
86 | #define ecb_artificial ecb_attribute ((__artificial__)) /* 4.3 */ |
86 | #define ecb_noinline ecb_attribute ((noinline)) |
87 | #define ecb_noinline ecb_attribute ((__noinline__)) |
87 | #define ecb_noreturn ecb_attribute ((noreturn)) |
88 | #define ecb_noreturn ecb_attribute ((__noreturn__)) |
88 | #define ecb_unused ecb_attribute ((unused)) |
89 | #define ecb_unused ecb_attribute ((__unused__)) |
89 | #define ecb_const ecb_attribute ((const)) |
90 | #define ecb_const ecb_attribute ((__const__)) |
90 | #define ecb_pure ecb_attribute ((pure)) |
91 | #define ecb_pure ecb_attribute ((__pure__)) |
91 | #define ecb_hot ecb_attribute ((hot)) /* 4.3 */ |
92 | #define ecb_hot ecb_attribute ((__hot__)) /* 4.3 */ |
92 | #define ecb_cold ecb_attribute ((cold)) /* 4.3 */ |
93 | #define ecb_cold ecb_attribute ((__cold__)) /* 4.3 */ |
93 | |
94 | |
94 | /* put into if's if you are very sure that the expression */ |
95 | /* put into if's if you are very sure that the expression */ |
95 | /* is mostly true or mosty false. note that these return */ |
96 | /* is mostly true or mosty false. note that these return */ |
96 | /* booleans, not the expression. */ |
97 | /* booleans, not the expression. */ |
97 | #define ecb_unlikely(expr) ecb_expect (!!(expr), 0) |
98 | #define ecb_unlikely(expr) ecb_expect (!!(expr), 0) |
… | |
… | |
100 | /* try to tell the compiler that some condition is definitely true */ |
101 | /* try to tell the compiler that some condition is definitely true */ |
101 | #define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) |
102 | #define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) |
102 | |
103 | |
103 | /* count trailing zero bits and count # of one bits */ |
104 | /* count trailing zero bits and count # of one bits */ |
104 | #if ECB_GCC_VERSION(3,4) |
105 | #if ECB_GCC_VERSION(3,4) |
105 | #define ecb_ctz32 (x) __builtin_ctz (x) |
106 | #define ecb_ctz32(x) __builtin_ctz (x) |
106 | #define ecb_popcount32 (x) __builtin_popcount (x) |
107 | #define ecb_popcount32(x) __builtin_popcount (x) |
107 | #else |
108 | #else |
108 | ECB_HEADER_INLINE int ecb_ctz32 (uint32_t x) ecb_const; |
109 | ECB_HEADER_INLINE int ecb_ctz32 (uint32_t x) ecb_const; |
109 | ECB_HEADER_INLINE |
110 | ECB_HEADER_INLINE |
110 | ecb_ctz32 (uint32_t x) |
111 | ecb_ctz32 (uint32_t x) |
111 | { |
112 | { |