@@ -48,9 +48,6 @@ fn longest_match_help<const SLOW: bool>(
48
48
let lookahead = state. lookahead ;
49
49
let mut match_offset = 0 ;
50
50
51
- let mut scan_start = [ 0u8 ; 8 ] ;
52
- let mut scan_end = [ 0u8 ; 8 ] ;
53
-
54
51
macro_rules! goto_next_in_chain {
55
52
( ) => {
56
53
chain_length -= 1 ;
@@ -84,16 +81,8 @@ fn longest_match_help<const SLOW: bool>(
84
81
}
85
82
}
86
83
87
- if UNALIGNED64_OK {
88
- scan_start. copy_from_slice ( & scan[ ..core:: mem:: size_of :: < u64 > ( ) ] ) ;
89
- scan_end. copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u64 > ( ) ] ) ;
90
- } else if UNALIGNED_OK {
91
- scan_start[ ..4 ] . copy_from_slice ( & scan[ ..core:: mem:: size_of :: < u32 > ( ) ] ) ;
92
- scan_end[ ..4 ] . copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u32 > ( ) ] ) ;
93
- } else {
94
- scan_start[ ..2 ] . copy_from_slice ( & scan[ ..core:: mem:: size_of :: < u16 > ( ) ] ) ;
95
- scan_end[ ..2 ] . copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u16 > ( ) ] ) ;
96
- }
84
+ let scan_start = window[ strstart..] . as_ptr ( ) ;
85
+ let mut scan_end = window[ strstart + offset..] . as_ptr ( ) ;
97
86
98
87
let mut mbase_start = window. as_ptr ( ) ;
99
88
let mut mbase_end = window[ offset..] . as_ptr ( ) ;
@@ -208,9 +197,6 @@ fn longest_match_help<const SLOW: bool>(
208
197
// this loop also breaks before cur_match gets past strstart, which is bounded by
209
198
// window_size - MIN_LOOKAHEAD, so 8 byte reads of mbase_end/start are in-bounds.
210
199
unsafe {
211
- let scan_start = scan_start. as_ptr ( ) ;
212
- let scan_end = scan_end. as_ptr ( ) ;
213
-
214
200
if UNALIGNED_OK {
215
201
if best_len < core:: mem:: size_of :: < u32 > ( ) {
216
202
loop {
@@ -289,13 +275,7 @@ fn longest_match_help<const SLOW: bool>(
289
275
}
290
276
}
291
277
292
- if UNALIGNED64_OK {
293
- scan_end. copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u64 > ( ) ] ) ;
294
- } else if UNALIGNED_OK {
295
- scan_end[ ..4 ] . copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u32 > ( ) ] ) ;
296
- } else {
297
- scan_end[ ..2 ] . copy_from_slice ( & scan[ offset..] [ ..core:: mem:: size_of :: < u16 > ( ) ] ) ;
298
- }
278
+ scan_end = window[ strstart + offset..] . as_ptr ( ) ;
299
279
300
280
// Look for a better string offset
301
281
if SLOW && len > STD_MIN_MATCH && match_start + len < strstart {
0 commit comments