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 | a5811b4ecd58d1311076287bb2a5b54ec376910e (patch) | |
tree | 134375c5a54bb3344fa7224228f7ca4905a6396b /include/ruby/ruby.h | |
parent | 8be7b505fb91d5d28a0d5cae54cc979610c626ad (diff) | |
download | ruby-a5811b4ecd58d1311076287bb2a5b54ec376910e.tar.gz ruby-a5811b4ecd58d1311076287bb2a5b54ec376910e.tar.xz ruby-a5811b4ecd58d1311076287bb2a5b54ec376910e.zip |
* include/ruby/ruby.h (RSTRING_END): trivial optimization.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby/ruby.h')
-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 19f146e4a..55836a8fd 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 { |