… | |
… | |
118 | #define ecb_expect_true(expr) ecb_expect (!!(expr), 1) |
118 | #define ecb_expect_true(expr) ecb_expect (!!(expr), 1) |
119 | /* for compatibility to the rest of the world */ |
119 | /* for compatibility to the rest of the world */ |
120 | #define ecb_likely(expr) ecb_expect_true (expr) |
120 | #define ecb_likely(expr) ecb_expect_true (expr) |
121 | #define ecb_unlikely(expr) ecb_expect_false (expr) |
121 | #define ecb_unlikely(expr) ecb_expect_false (expr) |
122 | |
122 | |
123 | /* try to tell the compiler that some condition is definitely true */ |
|
|
124 | #define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) |
|
|
125 | |
|
|
126 | /* count trailing zero bits and count # of one bits */ |
123 | /* count trailing zero bits and count # of one bits */ |
127 | #if ECB_GCC_VERSION(3,4) |
124 | #if ECB_GCC_VERSION(3,4) |
128 | #define ecb_ctz32(x) __builtin_ctz (x) |
125 | #define ecb_ctz32(x) __builtin_ctz (x) |
129 | #define ecb_popcount32(x) __builtin_popcount (x) |
126 | #define ecb_popcount32(x) __builtin_popcount (x) |
130 | #else |
127 | #else |
… | |
… | |
187 | #else |
184 | #else |
188 | /* this seems to work fine, but gcc always emits a warning for it :/ */ |
185 | /* this seems to work fine, but gcc always emits a warning for it :/ */ |
189 | ecb_function_ void ecb_unreachable (void) ecb_noreturn; |
186 | ecb_function_ void ecb_unreachable (void) ecb_noreturn; |
190 | ecb_function_ void ecb_unreachable (void) { } |
187 | ecb_function_ void ecb_unreachable (void) { } |
191 | #endif |
188 | #endif |
|
|
189 | |
|
|
190 | /* try to tell the compiler that some condition is definitely true */ |
|
|
191 | #define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) |
192 | |
192 | |
193 | ecb_function_ unsigned char ecb_byteorder_helper (void) ecb_const; |
193 | ecb_function_ unsigned char ecb_byteorder_helper (void) ecb_const; |
194 | ecb_function_ unsigned char |
194 | ecb_function_ unsigned char |
195 | ecb_byteorder_helper (void) |
195 | ecb_byteorder_helper (void) |
196 | { |
196 | { |