Ruby  3.4.0dev (2024-11-22 revision 37a72b0150ec36b4ea27175039afc28c62207b0c)
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"
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 */
Defines RBIMPL_HAS_BUILTIN.
Defines RBIMPL_ASSUME / RBIMPL_UNREACHABLE.