diff options
author | 卜部昌平 <[email protected]> | 2021-06-07 17:26:34 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2021-09-10 20:00:06 +0900 |
commit | ba814a5aa3c69322d616471e934592b261448645 (patch) | |
tree | 4f25c148edd654af14b8009ccd9abd4d42d46628 /include/ruby/backward | |
parent | 5107a6bf12e91b830acca044484ff123b6ac7f96 (diff) |
include/ruby/backward/2/assume.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4815
Diffstat (limited to 'include/ruby/backward')
-rw-r--r-- | include/ruby/backward/2/assume.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/include/ruby/backward/2/assume.h b/include/ruby/backward/2/assume.h index 73a247d48e..265421df79 100644 --- a/include/ruby/backward/2/assume.h +++ b/include/ruby/backward/2/assume.h @@ -26,15 +26,30 @@ #undef ASSUME /* Kill config.h definition */ #undef UNREACHABLE /* Kill config.h definition */ -#define ASSUME RBIMPL_ASSUME -#define UNREACHABLE RBIMPL_UNREACHABLE() -#define UNREACHABLE_RETURN RBIMPL_UNREACHABLE_RETURN +#define ASSUME RBIMPL_ASSUME /**< @old{RBIMPL_ASSUME} */ +#define UNREACHABLE RBIMPL_UNREACHABLE() /**< @old{RBIMPL_UNREACHABLE} */ +#define UNREACHABLE_RETURN RBIMPL_UNREACHABLE_RETURN /**< @old{RBIMPL_UNREACHABLE_RETURN} */ /* likely */ #if RBIMPL_HAS_BUILTIN(__builtin_expect) +/** + * Asserts that the given Boolean expression likely holds. + * + * @param x An expression that likely holds. + * + * @note Consider this macro carefully. It has been here since when CPUs were + * like babies, but contemporary processors are beasts. They are + * smarter than mare mortals like us today. Their branch predictions + * highly expectedly outperform your use of this macro. + */ # define RB_LIKELY(x) (__builtin_expect(!!(x), 1)) -# define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0)) +/** + * Asserts that the given Boolean expression likely doesn't hold. + * + * @param x An expression that likely doesn't hold. + */ +# define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0)) #else # define RB_LIKELY(x) (x) # define RB_UNLIKELY(x) (x) |