23 lines
753 B
C
23 lines
753 B
C
#ifndef INCLUDED_C_COMPILER_MSVC_H
|
|
#define INCLUDED_C_COMPILER_MSVC_H
|
|
|
|
#define C_INLINE __forceinline
|
|
#define C_NOINLINE __declspec(noinline)
|
|
|
|
#define C_STATIC_FORCE_INLINE static C_INLINE
|
|
|
|
#define C_PACKED_STRUCT_START __pragma(pack(push, 1))
|
|
#define C_PACKED_STRUCT_END __pragma(pack(pop))
|
|
#define C_PACKED /* MSVC 不支持通过单行后缀修饰变量 */
|
|
|
|
#define C_ALIGN(bytes) __declspec(align(bytes))
|
|
|
|
/* 通知编译器两个指针指向的内存绝不重叠,用于大幅提升数学库(Math)的向量化效率 */
|
|
#define C_RESTRICT __restrict
|
|
|
|
/* 用于 Search / Sort 等高频判断分支,提示 CPU 哪条分支概率更高 */
|
|
#define C_LIKELY(x) (x)
|
|
#define C_UNLIKELY(x) (x)
|
|
|
|
#endif /*INCLUDED_C_COMPILER_MSVC_H*/
|