aboutsummaryrefslogtreecommitdiff
path: root/src/unlikely.h
blob: 72f51b64236bcdcf5b4518bd53c8c5fb1dd7e1ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef INPLA_UNLIKELY_H_
#define INPLA_UNLIKELY_H_

#if defined(__GNUC__) || defined(__clang__)
    // For GCC, Clang
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
#else
    // Otherwise
    #define likely(x)   (x)
    #define unlikely(x) (x)
#endif

#endif