PETSc version 3.17.5
Fix/Edit manual page

PetscLikely

Hints the compiler that the given condition is usually TRUE

Synopsis

#include <petscmacros.h>
bool PetscLikely(bool cond)
Not Collective

Input Parameter

cond - Boolean expression

Notes

Not available from fortran.

This returns the same truth value, it is only a hint to compilers that the result of cond is likely to be true.

Example usage

  if (PetscLikely(cond)) {
    foo(); // hot path
  } else {
    bar(); // cold path
  }

See Also

PetscUnlikely(), PetscDefined(), PetscHasAttribute()
PETSC_ATTRIBUTE_COLD

Level

advanced

Location

include/petscmacros.h

Examples

src/sys/tutorials/ex6.c.html

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages