EllAlgo 1.6.13
Loading...
Searching...
No Matches
Macros
ell_assert.hpp File Reference

Branch prediction macros for performance optimization. More...

Go to the source code of this file.

Macros

#define ELL_LIKELY(x)   (!!(x))
 Hint that the expression is likely to be true.
 
#define ELL_UNLIKELY(x)   (!!(x))
 Hint that the expression is unlikely to be true.
 

Detailed Description

Branch prediction macros for performance optimization.

This header provides macros for giving hints to the compiler about the likelihood of certain conditions being true or false. This can help the CPU generate more efficient code by optimizing branch prediction.

Macro Definition Documentation

◆ ELL_LIKELY

#define ELL_LIKELY (   x)    (!!(x))

Hint that the expression is likely to be true.

This macro tells the compiler that the expression is likely to evaluate to true, allowing it to optimize the generated code for the common case.

Parameters
xThe expression to evaluate
Returns
The same expression value

◆ ELL_UNLIKELY

#define ELL_UNLIKELY (   x)    (!!(x))

Hint that the expression is unlikely to be true.

This macro tells the compiler that the expression is unlikely to evaluate to true, allowing it to optimize the generated code for the uncommon case. This is typically used for error conditions or exceptional paths.

Parameters
xThe expression to evaluate
Returns
The same expression value