Loading...
Searching...
No Matches
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 __noreturn __attribute__((__noreturn__))
37#define __must_check __attribute__((__warn_unused_result__))
41#define __weak __attribute__((__weak__))
45#define __maybe_unused __attribute__((__unused__))
49#define __aligned(__n) __attribute__((aligned (__n)))
53#define __deprecated __attribute__((__deprecated__))
57#define __packed __attribute__((__packed__))
61#define __alloc_size(__args) __attribute__((__alloc_size__(__args)))
64#define __align_to(__size, __al) (((__size) + (__al) - 1) & (~((__al) - 1)))
70#define xenomai_count_trailing_zeros(x) \
71 ((x) == 0 ? (int)(sizeof(x) * __CHAR_BIT__) \
72 : sizeof(x) <= sizeof(unsigned int) ? \
73 __builtin_ctz((unsigned int)x) \
74 : sizeof(x) <= sizeof(unsigned long) ? \
75 __builtin_ctzl((unsigned long)x) \
78#define xenomai_count_leading_zeros(x) \
79 ((x) == 0 ? (int)(sizeof(x) * __CHAR_BIT__) \
80 : sizeof(x) <= sizeof(unsigned int) ? \
81 __builtin_clz((unsigned int)x) + \
82 (int)(sizeof(unsigned int) - sizeof(x)) \
83 : sizeof(x) <= sizeof(unsigned long) ? \
84 __builtin_clzl((unsigned long)x) \