blob: 602c7238d9dbedaa362bbf98ba6725b331ee19c3 (
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__)
// GCC と Clang の場合は、極限まで最適化!
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else
// それ以外のコンパイラ(MSVCなど)では、ただの素通り(無害化)
#define likely(x) (x)
#define unlikely(x) (x)
#endif
#endif
|