diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-30 16:32:36 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-30 16:32:36 +0000 |
commit | e9a5fdf8e7353dad0e9a8091cce4a4d08e2e22aa (patch) | |
tree | 3bb85d9a5a096e2ac6c5f0ff38fbc123294acac0 /string.c | |
parent | 222b56377f97ed044365f1bec5e7050652b291c7 (diff) | |
download | ruby-e9a5fdf8e7353dad0e9a8091cce4a4d08e2e22aa.tar.gz |
More optimization for r54854's search_nonascii
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -455,19 +455,19 @@ search_nonascii(const char *p, const char *e) p = (const char *)s; } - switch ((e - p) % SIZEOF_VOIDP) { + switch (e - p) { + default: UNREACHABLE; #if SIZEOF_VOIDP > 4 - case 7: if (*p&0x80) return p; p++; - case 6: if (*p&0x80) return p; p++; - case 5: if (*p&0x80) return p; p++; - case 4: if (*p&0x80) return p; p++; + case 7: if (e[-7]&0x80) return e-7; + case 6: if (e[-6]&0x80) return e-6; + case 5: if (e[-5]&0x80) return e-5; + case 4: if (e[-4]&0x80) return e-4; #endif - case 3: if (*p&0x80) return p; p++; - case 2: if (*p&0x80) return p; p++; - case 1: if (*p&0x80) return p; + case 3: if (e[-3]&0x80) return e-3; + case 2: if (e[-2]&0x80) return e-2; + case 1: if (e[-1]&0x80) return e-1; + case 0: return NULL; } - - return NULL; } static int |