diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-09 12:50:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-09 12:50:59 -0300 |
commit | a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7 (patch) | |
tree | 46c3a143f3b703023d884e769485080862a3c27d /luaconf.h | |
parent | 511d53a826760dd11cd82947184583e2d094e2d2 (diff) | |
download | lua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.tar.gz lua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.tar.bz2 lua-a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7.zip |
Uses of "likely" in macros active to all users
The use of 'l_likely' in auxlib macros 'luaL_argcheck' and
'luaL_argexpected' should not be restricted to Lua's own code.
For that, 'l_likely' was renamed to 'luai_likely' to be exported
to external code.
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -665,20 +665,26 @@ | |||
665 | ** macros to improve jump prediction, used mostly for error handling | 665 | ** macros to improve jump prediction, used mostly for error handling |
666 | ** and debug facilities. | 666 | ** and debug facilities. |
667 | */ | 667 | */ |
668 | #if (defined(LUA_CORE) || defined(LUA_LIB)) && !defined(l_likely) | 668 | #if !defined(luai_likely) |
669 | 669 | ||
670 | #include <stdio.h> | ||
671 | #if defined(__GNUC__) | 670 | #if defined(__GNUC__) |
672 | #define l_likely(x) (__builtin_expect(((x) != 0), 1)) | 671 | #define luai_likely(x) (__builtin_expect(((x) != 0), 1)) |
673 | #define l_unlikely(x) (__builtin_expect(((x) != 0), 0)) | 672 | #define luai_unlikely(x) (__builtin_expect(((x) != 0), 0)) |
674 | #else | 673 | #else |
675 | #define l_likely(x) (x) | 674 | #define luai_likely(x) (x) |
676 | #define l_unlikely(x) (x) | 675 | #define luai_unlikely(x) (x) |
677 | #endif | 676 | #endif |
678 | 677 | ||
679 | #endif | 678 | #endif |
680 | 679 | ||
681 | 680 | ||
681 | #if defined(LUA_CORE) || defined(LUA_LIB) | ||
682 | /* shorter names for Lua's own use */ | ||
683 | #define l_likely(x) luai_likely(x) | ||
684 | #define l_unlikely(x) luai_unlikely(x) | ||
685 | #endif | ||
686 | |||
687 | |||
682 | 688 | ||
683 | /* }================================================================== */ | 689 | /* }================================================================== */ |
684 | 690 | ||