1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

RARRAY_EMBED_LEN/RSTRING_EMBED_LEN: add RUBY3_CAST

RUBY3_CAST is a macro to suppress g++/clang++ warnings about C-style
casts.  Though Ruby core don't have to bother C++ situations, extension
libraries can benefit from this.
This commit is contained in:
卜部昌平 2020-04-08 22:32:02 +09:00
parent ec1b3464da
commit dd04b8034b
2 changed files with 2 additions and 2 deletions

View file

@ -123,7 +123,7 @@ RARRAY_EMBED_LEN(VALUE ary)
VALUE f = RBASIC(ary)->flags;
f &= RARRAY_EMBED_LEN_MASK;
f >>= RARRAY_EMBED_LEN_SHIFT;
return (long)f;
return RUBY3_CAST((long)f);
}
RUBY3_ATTR_PURE_ON_NDEBUG()

View file

@ -108,7 +108,7 @@ RSTRING_EMBED_LEN(VALUE str)
VALUE f = RBASIC(str)->flags;
f &= RSTRING_EMBED_LEN_MASK;
f >>= RSTRING_EMBED_LEN_SHIFT;
return (long)f;
return RUBY3_CAST((long)f);
}
RUBY3_ATTR_PURE_ON_NDEBUG()