ruby-changes:13769
From: nobu <ko1@a...>
Date: Fri, 30 Oct 2009 04:47:43 +0900 (JST)
Subject: [ruby-changes:13769] Ruby:r25565 (trunk): * include/ruby/ruby.h (RSTRING_END): trivial optimization.
nobu 2009-10-30 04:47:28 +0900 (Fri, 30 Oct 2009) New Revision: 25565 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25565 Log: * include/ruby/ruby.h (RSTRING_END): trivial optimization. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 25564) +++ include/ruby/ruby.h (revision 25565) @@ -619,7 +619,12 @@ (!(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 { Index: ChangeLog =================================================================== --- ChangeLog (revision 25564) +++ ChangeLog (revision 25565) @@ -1,5 +1,7 @@ -Fri Oct 30 04:44:01 2009 Nobuyoshi Nakada <nobu@r...> +Fri Oct 30 04:47:26 2009 Nobuyoshi Nakada <nobu@r...> + * include/ruby/ruby.h (RSTRING_END): trivial optimization. + * string.c (rb_str_sub_bang): trivial optimization. Fri Oct 30 02:11:36 2009 Yukihiro Matsumoto <matz@r...> -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/