mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-12 19:30:10 +00:00
28 lines
470 B
C
28 lines
470 B
C
|
#pragma once
|
||
|
|
||
|
#ifdef _MSC_VER
|
||
|
|
||
|
# include <intrin.h>
|
||
|
|
||
|
# define LIKELY(x) (x)
|
||
|
# define UNLIKELY(x) (x)
|
||
|
|
||
|
# define EIGHTBIT_PARITY(x) (__popcnt(value) % 2)
|
||
|
|
||
|
# define UNREACHABLE __assume(0)
|
||
|
|
||
|
#elif definef(__GNUG__)
|
||
|
|
||
|
# include <x86intrin.h>
|
||
|
|
||
|
# define LIKELY(x) __builtin_expect(!!(x), 1)
|
||
|
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||
|
|
||
|
# define EIGHTBIT_PARITY(x) __builtin_parity(value)
|
||
|
|
||
|
# define UNREACHABLE __builtin_unreachable();
|
||
|
|
||
|
#else
|
||
|
# error Unknown compiler
|
||
|
#endif
|