summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 16:32:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 16:32:36 +0000
commit424a706afec48116d71b615541fbdb6b1ab3d414 (patch)
tree3bb85d9a5a096e2ac6c5f0ff38fbc123294acac0 /string.c
parent30c2d8ba85b6dcdf4ef8fc5afdf39ce4ed78a089 (diff)
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.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/string.c b/string.c
index e2cb68aac2..04fc5d063d 100644
--- a/string.c
+++ b/string.c
@@ -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