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

Ruby 3.4.3p32 (2025-04-14 revision d0b7e5b6a04bde21ca483d20a1546b28b401c2d4)

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
30
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.