mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-03-30 06:19:05 +03:00
Add likely/unlikely defines for using built-in function provided by GCC
This commit is contained in:
parent
5cc2725229
commit
94cee479ed
@ -43,7 +43,7 @@ static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
|
|||||||
|
|
||||||
for (auto var : g_sInaccessibleXVars)
|
for (auto var : g_sInaccessibleXVars)
|
||||||
{
|
{
|
||||||
if (!strcmp(sName, var))
|
if (likely(!strcmp(sName, var)))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "CFrameAction.h"
|
#include "CFrameAction.h"
|
||||||
#include <amxmodx_version.h>
|
#include <amxmodx_version.h>
|
||||||
#include <HLTypeConversion.h>
|
#include <HLTypeConversion.h>
|
||||||
|
#include "extdef.h"
|
||||||
|
|
||||||
#define AMXXLOG_Log g_log.Log
|
#define AMXXLOG_Log g_log.Log
|
||||||
#define AMXXLOG_Error g_log.LogError
|
#define AMXXLOG_Error g_log.LogError
|
||||||
|
10
amxmodx/extdef.h
Normal file
10
amxmodx/extdef.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Manual branch optimization for GCC 3.0.0 and newer
|
||||||
|
#if !defined(__GNUC__) || __GNUC__ < 3
|
||||||
|
#define likely(x) (x)
|
||||||
|
#define unlikely(x) (x)
|
||||||
|
#else
|
||||||
|
#define likely(x) __builtin_expect(!!(x), 1)
|
||||||
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
#endif
|
@ -429,6 +429,7 @@ md -p JIT 2>NUL
|
|||||||
<ClInclude Include="..\CVault.h" />
|
<ClInclude Include="..\CVault.h" />
|
||||||
<ClInclude Include="..\datastructs.h" />
|
<ClInclude Include="..\datastructs.h" />
|
||||||
<ClInclude Include="..\debugger.h" />
|
<ClInclude Include="..\debugger.h" />
|
||||||
|
<ClInclude Include="..\extdef.h" />
|
||||||
<ClInclude Include="..\fakemeta.h" />
|
<ClInclude Include="..\fakemeta.h" />
|
||||||
<ClInclude Include="..\format.h" />
|
<ClInclude Include="..\format.h" />
|
||||||
<ClInclude Include="..\gameconfigs.h" />
|
<ClInclude Include="..\gameconfigs.h" />
|
||||||
|
@ -584,6 +584,9 @@
|
|||||||
<ClInclude Include="..\CFrameAction.h">
|
<ClInclude Include="..\CFrameAction.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\extdef.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\version.rc">
|
<ResourceCompile Include="..\version.rc">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user