Portable branch prediction hints

后端 未结 6 1851
谎友^
谎友^ 2020-12-05 02:07

Is there any portable way of doing branch prediction hints? Consider the following example:

  if (unlikely_condition) {
    /* ..A.. */
  } else {
    /* ..B         


        
6条回答
  •  眼角桃花
    2020-12-05 02:41

    Just be consistant with what you do. I like to use

    if (!(someExpression))
    

    But the compiler should treat this equally.

提交回复
热议问题