Ruby: include/ruby/backward/2/assume.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

assume.h
Go to the documentation of this file.
1#ifndef RUBY_BACKWARD2_ASSUME_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RUBY_BACKWARD2_ASSUME_H
23#include "ruby/internal/config.h"
24#include "ruby/internal/assume.h"
25#include "ruby/internal/has/builtin.h"
26
27#define ASSUME RBIMPL_ASSUME
28#define UNREACHABLE RBIMPL_UNREACHABLE()
29#define UNREACHABLE_RETURN RBIMPL_UNREACHABLE_RETURN
31/* likely */
32#if RBIMPL_HAS_BUILTIN(__builtin_expect)
43# define RB_LIKELY(x) (__builtin_expect(!!(x), 1))
44
50# define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0))
51#else
52# define RB_LIKELY(x) (x)
53# define RB_UNLIKELY(x) (x)
54#endif
55
56#endif /* RUBY_BACKWARD2_ASSUME_H */
builtin.h
Defines RBIMPL_HAS_BUILTIN.
assume.h
Defines RBIMPL_ASSUME / RBIMPL_UNREACHABLE.