зеркало из https://github.com/github/ruby.git
* re.c (rb_memsearch): performance improvement by using memchr().
[ruby-dev:45397] [Feature #6173] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6ce8c33936
Коммит
9f9ebe4eba
|
@ -1,3 +1,8 @@
|
|||
Thu Nov 8 21:57:59 2012 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* re.c (rb_memsearch): performance improvement by using memchr().
|
||||
[ruby-dev:45397] [Feature #6173]
|
||||
|
||||
Thu Nov 8 19:02:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
|
||||
|
|
12
re.c
12
re.c
|
@ -220,12 +220,12 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
|
|||
return 0;
|
||||
}
|
||||
else if (m == 1) {
|
||||
const unsigned char *ys = y, *ye = ys + n;
|
||||
for (; y < ye; ++y) {
|
||||
if (*x == *y)
|
||||
return y - ys;
|
||||
}
|
||||
return -1;
|
||||
const unsigned char *ys;
|
||||
|
||||
if (ys = memchr(y, *x, n))
|
||||
return ys - y;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if (m <= SIZEOF_VALUE) {
|
||||
return rb_memsearch_ss(x0, m, y0, n);
|
||||
|
|
Загрузка…
Ссылка в новой задаче