22 lines
644 B
C
22 lines
644 B
C
#ifndef INCLUDED_C_COMPILER_GCC_H
|
|||
|
|
#define INCLUDED_C_COMPILER_GCC_H
|
||
|
|
|
||
|
|
#define C_INLINE inline __attribute__((always_inline))
|
||
|
|
#define C_NOINLINE __attribute__((noinline))
|
||
|
|
|
||
|
|
#define C_STATIC_FORCE_INLINE static C_INLINE
|
||
|
|
|
||
|
|
#define C_PACKED_STRUCT_START
|
||
|
|
#define C_PACKED_STRUCT_END
|
||
|
|
#define C_PACKED __attribute__((packed))
|
||
|
|
|
||
|
|
#define C_ALIGN(bytes) __attribute__((aligned(bytes)))
|
||
|
|
|
||
|
|
#define C_RESTRICT __restrict__
|
||
|
|
|
||
|
|
/* 用于 Search / Sort 等高频判断分支,提示 CPU 哪条分支概率更高 */
|
||
|
|
#define C_LIKELY(x) __builtin_expect(!!(x), 1)
|
||
|
|
#define C_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||
|
|
|
||
|
|
#endif /*INCLUDED_C_COMPILER_GCC_H*/
|