Skip to content

Commit

Permalink
Added option LUA_NOBUILTIN
Browse files Browse the repository at this point in the history
This option allows external code to avoid the use of gcc builtin macro
'__builtin_expect' in the Lua API.
  • Loading branch information
roberto-ieru committed Mar 12, 2021
1 parent 014daf4 commit eadd8c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions luaconf.h
Expand Up @@ -663,11 +663,13 @@

/*
** macros to improve jump prediction, used mostly for error handling
** and debug facilities.
** and debug facilities. (Some macros in the Lua API use these macros.
** Define LUA_NOBUILTIN if you do not want '__builtin_expect' in your
** code.)
*/
#if !defined(luai_likely)

#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(LUA_NOBUILTIN)
#define luai_likely(x) (__builtin_expect(((x) != 0), 1))
#define luai_unlikely(x) (__builtin_expect(((x) != 0), 0))
#else
Expand Down

0 comments on commit eadd8c7

Please sign in to comment.