18 #ifndef _BOILERPLATE_COMPILER_H 19 #define _BOILERPLATE_COMPILER_H 23 #define container_of(ptr, type, member) \ 25 const __typeof__(((type *)0)->member) *__mptr = (ptr); \ 26 (type *)((char *)__mptr - offsetof(type, member)); \ 29 #define __stringify_1(x...) #x 30 #define __stringify(x...) __stringify_1(x) 33 #define likely(x) __builtin_expect(!!(x), 1) 34 #define unlikely(x) __builtin_expect(!!(x), 0) 38 #define __noreturn __attribute__((__noreturn__)) 42 #define __must_check __attribute__((__warn_unused_result__)) 46 #define __weak __attribute__((__weak__)) 50 #define __const __attribute__((__const__)) 54 #define __pure __attribute__((__pure__)) 57 #ifndef __maybe_unused 58 #define __maybe_unused __attribute__((__unused__)) 62 #define __aligned(__n) __attribute__((aligned (__n))) 66 #define __deprecated __attribute__((__deprecated__)) 70 #define __packed __attribute__((__packed__)) 74 #define __alloc_size(__args) __attribute__((__alloc_size__(__args))) 77 #define __align_to(__size, __al) (((__size) + (__al) - 1) & (~((__al) - 1))) 83 void __invalid_operand_size(
void);
89 __ret = sizeof(__v) * 8; \ 91 switch (sizeof(__v)) { \ 93 __ret = __builtin_ctz((unsigned int)__v); \ 95 case sizeof(long long): \ 96 __ret = __builtin_ctzll(__v); \ 99 __invalid_operand_size(); \ 108 __ret = sizeof(__v) * 8; \ 110 switch (sizeof(__v)) { \ 112 __ret = __builtin_clz((unsigned int)__v); \ 114 case sizeof(long long): \ 115 __ret = __builtin_clzll(__v); \ 118 __invalid_operand_size(); \