Project

General

Profile

Actions

Bug #10856

open

add likely and unlikely macros to sys/ccompile.h

Added by Jerry Jelinek over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2019-04-26
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

There are currently several duplicate definitions of the likely and unlikely macros in the source tree. We should have one common definition in sys/ccompile.h This one from lz4.c is a good example to follow

#if (GCC_VERSION >= 302) || (INTEL_COMPILER >= 800) || defined(_clang)
#define expect(expr, value) (
_builtin_expect((expr), (value)))
#else
#define expect(expr, value) (expr)
#endif

#define likely(expr) expect((expr) != 0, 1)
#define unlikely(expr) expect((expr) != 0, 0)

No data to display

Actions

Also available in: Atom PDF