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

* include/ruby/ruby.h (RSTRING_END): trivial optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-29 19:47:28 +00:00
parent 2aa4d69d78
commit 22bd95ded4
2 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,6 @@
Fri Oct 30 04:44:01 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Oct 30 04:47:26 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (RSTRING_END): trivial optimization.
* string.c (rb_str_sub_bang): trivial optimization.

View file

@ -619,7 +619,12 @@ struct RString {
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
RSTRING(str)->as.ary : \
RSTRING(str)->as.heap.ptr)
#define RSTRING_END(str) (RSTRING_PTR(str)+RSTRING_LEN(str))
#define RSTRING_END(str) \
(!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \
(RSTRING(str)->as.ary + \
((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
(RSTRING_EMBED_LEN_MASK >> RSTRING_EMBED_LEN_SHIFT))) : \
(RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len))
#define RARRAY_EMBED_LEN_MAX 3
struct RArray {