Skip to content

Commit 4598abb

Browse files
author
Ulrik Sverdrup
committed
---
yaml --- r: 217279 b: refs/heads/master c: 274bb24 h: refs/heads/master i: 217277: eac1f52 217275: eb9941d 217271: 6763cac 217263: fc724b0 217247: 7df352b 217215: 1e102cd v: v3
1 parent e7b1b63 commit 4598abb

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 71006bd6545015d7ae8e4c18589812bc1f6373dd
2+
refs/heads/master: 274bb24efdbeed0ab1a91f3c02f86551ef16eac7
33
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/libcore/str/pattern.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
628628
}
629629
}
630630

631-
#[inline]
631+
#[inline(always)]
632632
fn next_match(&mut self) -> Option<(usize, usize)> {
633633
match self.searcher {
634634
StrSearcherImpl::Empty(..) => {
@@ -642,9 +642,15 @@ unsafe impl<'a, 'b> Searcher<'a> for StrSearcher<'a, 'b> {
642642
}
643643
StrSearcherImpl::TwoWay(ref mut searcher) => {
644644
let is_long = searcher.memory == usize::MAX;
645-
searcher.next::<MatchOnly>(self.haystack.as_bytes(),
646-
self.needle.as_bytes(),
647-
is_long)
645+
if is_long {
646+
searcher.next::<MatchOnly>(self.haystack.as_bytes(),
647+
self.needle.as_bytes(),
648+
true)
649+
} else {
650+
searcher.next::<MatchOnly>(self.haystack.as_bytes(),
651+
self.needle.as_bytes(),
652+
false)
653+
}
648654
}
649655
}
650656
}
@@ -854,7 +860,7 @@ impl TwoWaySearcher {
854860
// left to right. If v matches, we try to match u by scanning right to left.
855861
// How far we can jump when we encounter a mismatch is all based on the fact
856862
// that (u, v) is a critical factorization for the needle.
857-
#[inline]
863+
#[inline(always)]
858864
fn next<S>(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
859865
-> S::Output
860866
where S: TwoWayStrategy

0 commit comments

Comments
 (0)