mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Don't use __builtin_expect
Partially revert previous patch and use unlikey() just as code annotation. Actually it is better to rely on a profiler for branch prediction: http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html "In fact, even when only one in ten thousand values is nonzero, we're still at only roughly the break-even point" No functional change,
This commit is contained in:
parent
cbb1a8ed31
commit
46fdb14b2f
1 changed files with 2 additions and 8 deletions
10
src/types.h
10
src/types.h
|
@ -42,6 +42,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#define unlikely(x) (x) // For code annotation purposes
|
||||||
|
|
||||||
#if defined(_WIN64) && !defined(IS_64BIT)
|
#if defined(_WIN64) && !defined(IS_64BIT)
|
||||||
# include <intrin.h> // MSVC popcnt and bsfq instrinsics
|
# include <intrin.h> // MSVC popcnt and bsfq instrinsics
|
||||||
# define IS_64BIT
|
# define IS_64BIT
|
||||||
|
@ -71,14 +73,6 @@
|
||||||
# define FORCE_INLINE inline
|
# define FORCE_INLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# define likely(x) __builtin_expect(!!(x), 1)
|
|
||||||
# define unlikely(x) __builtin_expect(!!(x), 0)
|
|
||||||
#else
|
|
||||||
# define likely(x) (x)
|
|
||||||
# define unlikely(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_POPCNT)
|
#if defined(USE_POPCNT)
|
||||||
const bool HasPopCnt = true;
|
const bool HasPopCnt = true;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue