likely/unlikely equivalent for MSVC

前端 未结 6 1577
醉话见心
醉话见心 2020-12-02 18:19

GCC compiler supports __builtin_expect statement that is used to define likely and unlikely macros.

eg.

#define likely(expr)    (__builtin_expect(!!(         


        
6条回答
  •  时光说笑
    2020-12-02 19:00

    __assume should be similar.

    However, if you want to do this really well you should use Profile Guided Optimization rather than static hints.

提交回复
热议问题