Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
st_data_t.h
Go to the documentation of this file.
1#ifndef RBIMPL_ARITHMERIC_ST_DATA_T_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ARITHMERIC_ST_DATA_T_H
28#include "ruby/internal/cast.h"
29#include "ruby/internal/value.h"
30#include "ruby/assert.h"
31#include "ruby/st.h"
32
33#define ST2FIX RB_ST2FIX
35#define RB_ST2FIX RB_ST2FIX
41/* See also [ruby-core:84395] [Bug #14218] [ruby-core:82687] [Bug #13877] */
42static inline VALUE
44{
45 SIGNED_VALUE x = i;
46
47 if (x >= 0) {
48 x &= RUBY_FIXNUM_MAX;
49 }
50 else {
51 x |= RUBY_FIXNUM_MIN;
52 }
53
55 unsigned long y = RBIMPL_CAST((unsigned long)x);
56 return RB_LONG2FIX(y);
57}
58
59#endif /* RBIMPL_ARITHMERIC_ST_DATA_T_H */
Defines RBIMPL_ATTR_ARTIFICIAL.
#define RBIMPL_ATTR_ARTIFICIAL()
Wraps (or simulates) __attribute__((artificial))
Definition: artificial.h:43
#define RBIMPL_ASSERT_OR_ASSUME(expr)
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
Definition: assert.h:229
Defines RBIMPL_CAST.
Defines RBIMPL_ATTR_CONST.
#define RBIMPL_ATTR_CONST_UNLESS_DEBUG()
Enables RBIMPL_ATTR_CONST iff.
Definition: const.h:41
RBIMPL_ATTR_CONSTEXPR.
#define RBIMPL_ATTR_CONSTEXPR_UNLESS_DEBUG(_)
Enables RBIMPL_ATTR_CONSTEXPR iff.
Definition: constexpr.h:80
Handling of integers formerly known as Fixnums.
#define RB_FIXABLE(_)
Definition: fixnum.h:40
#define RUBY_FIXNUM_MAX
Definition: fixnum.h:41
#define RUBY_FIXNUM_MIN
Definition: fixnum.h:42
Arithmetic conversion between C's long and Ruby's.
#define RB_LONG2FIX
Definition: long.h:55
#define RB_ST2FIX(h)
Definition: ruby_missing.h:20
unsigned long st_data_t
Definition: st.h:22
Defines VALUE and ID.
unsigned long VALUE
Definition: value.h:38
#define SIGNED_VALUE
Definition: value.h:40