diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-29 19:47:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-29 19:47:28 +0000 |
commit | 22bd95ded46f7163bde16e4782648de2ce5e87a1 (patch) | |
tree | 134375c5a54bb3344fa7224228f7ca4905a6396b /include | |
parent | 2aa4d69d78405faf543da65969a17988799a1bba (diff) | |
download | ruby-22bd95ded46f7163bde16e4782648de2ce5e87a1.tar.gz |
* 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
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/ruby.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 19f146e4ad..55836a8fd4 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -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 { |