summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ruby/ruby.h11
-rw-r--r--internal.h6
2 files changed, 11 insertions, 6 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index d983114e0a..11387b540a 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -903,10 +903,15 @@ VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change kl
#define RBASIC_CLASS(obj) (RBASIC(obj)->klass)
+#define RVALUE_EMBED_LEN_MAX RVALUE_EMBED_LEN_MAX
+enum ruby_rvalue_flags {
+ RVALUE_EMBED_LEN_MAX = 3,
+};
+
#define ROBJECT_EMBED_LEN_MAX ROBJECT_EMBED_LEN_MAX
#define ROBJECT_EMBED ROBJECT_EMBED
enum ruby_robject_flags {
- ROBJECT_EMBED_LEN_MAX = 3,
+ ROBJECT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
ROBJECT_EMBED = RUBY_FL_USER1,
ROBJECT_ENUM_END
@@ -972,7 +977,7 @@ enum ruby_rstring_flags {
RSTRING_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|
RUBY_FL_USER5|RUBY_FL_USER6),
RSTRING_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+2),
- RSTRING_EMBED_LEN_MAX = (int)((sizeof(VALUE)*3)/sizeof(char)-1),
+ RSTRING_EMBED_LEN_MAX = (int)((sizeof(VALUE)*RVALUE_EMBED_LEN_MAX)/sizeof(char)-1),
RSTRING_FSTR = RUBY_FL_USER17,
RSTRING_ENUM_END
@@ -1018,7 +1023,7 @@ struct RString {
#endif
enum ruby_rarray_flags {
- RARRAY_EMBED_LEN_MAX = 3,
+ RARRAY_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
RARRAY_EMBED_FLAG = RUBY_FL_USER1,
/* RUBY_FL_USER2 is for ELTS_SHARED */
RARRAY_EMBED_LEN_MASK = (RUBY_FL_USER4|RUBY_FL_USER3),
diff --git a/internal.h b/internal.h
index 77f9a3202f..50a20a2bf6 100644
--- a/internal.h
+++ b/internal.h
@@ -673,8 +673,8 @@ rb_fix_mod_fix(VALUE x, VALUE y)
#define BIGNUM_EMBED_LEN_NUMBITS 3
#ifndef BIGNUM_EMBED_LEN_MAX
-# if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
-# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
+# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
+# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
# else
# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
# endif
@@ -830,7 +830,7 @@ extern void ruby_init_setproctitle(int argc, char *argv[]);
#define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
enum {
- RSTRUCT_EMBED_LEN_MAX = 3,
+ RSTRUCT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
RSTRUCT_TRANSIENT_FLAG = FL_USER3,