@@ -367,7 +367,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
367367 let mut best_len: usize = best_len_in;
368368 let cached_backward: usize = distance_cache[ 0 ] as usize ;
369369 let mut prev_ix: usize = cur_ix. wrapping_sub ( cached_backward) ;
370- let mut is_match_found: i32 = 0i32 ;
370+ let mut is_match_found = false ;
371371 out. len_x_code = 0usize ;
372372 if prev_ix < cur_ix {
373373 prev_ix &= ring_buffer_mask as u32 as usize ;
@@ -388,7 +388,7 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
388388 self . buckets_ . slice_mut ( ) [ key as usize ] = cur_ix as u32 ;
389389 return true ;
390390 } else {
391- is_match_found = 1i32 ;
391+ is_match_found = true ;
392392 }
393393 }
394394 }
@@ -440,12 +440,12 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
440440 out. distance = backward;
441441 out. score = score;
442442 compare_char = data[ cur_ix_masked. wrapping_add ( best_len) ] as i32 ;
443- is_match_found = 1i32 ;
443+ is_match_found = true ;
444444 }
445445 }
446446 }
447447 }
448- if dictionary. is_some ( ) && self . buckets_ . USE_DICTIONARY ( ) != 0 && ( is_match_found == 0 ) {
448+ if dictionary. is_some ( ) && self . buckets_ . USE_DICTIONARY ( ) != 0 && ! is_match_found {
449449 is_match_found = SearchInStaticDictionary (
450450 dictionary. unwrap ( ) ,
451451 dictionary_hash,
@@ -455,13 +455,13 @@ impl<T: SliceWrapperMut<u32> + SliceWrapper<u32> + BasicHashComputer> AnyHasher
455455 max_backward. wrapping_add ( gap) ,
456456 max_distance,
457457 out,
458- 1i32 ,
458+ true ,
459459 ) ;
460460 }
461461 self . buckets_ . slice_mut ( )
462462 [ ( key as usize ) . wrapping_add ( ( cur_ix >> 3 ) . wrapping_rem ( bucket_sweep as usize ) ) ] =
463463 cur_ix as u32 ;
464- is_match_found != 0
464+ is_match_found
465465 }
466466}
467467impl < AllocU32 : alloc:: Allocator < u32 > > BasicHashComputer for H2Sub < AllocU32 > {
@@ -735,7 +735,7 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
735735 let cur_ix_masked: usize = cur_ix & ring_buffer_mask;
736736 let mut best_score: u64 = out. score ;
737737 let mut best_len: usize = best_len_in;
738- let mut is_match_found: i32 = 0i32 ;
738+ let mut is_match_found = false ;
739739 out. len_x_code = 0usize ;
740740 for i in 0 ..H9_NUM_LAST_DISTANCES_TO_CHECK {
741741 let idx = kDistanceCacheIndex[ i] as usize ;
@@ -767,7 +767,7 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
767767 out. len = best_len;
768768 out. distance = backward;
769769 out. score = best_score;
770- is_match_found = 1i32 ;
770+ is_match_found = true ;
771771 }
772772 }
773773 }
@@ -821,7 +821,7 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
821821 out. len = best_len;
822822 out. distance = backward;
823823 out. score = best_score;
824- is_match_found = 1 ;
824+ is_match_found = true ;
825825 if cur_ix_masked. wrapping_add ( best_len) > ring_buffer_mask {
826826 break ;
827827 }
@@ -833,7 +833,7 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
833833 bucket[ * self_num_key as usize & H9_BLOCK_MASK ] = cur_ix as u32 ;
834834 * self_num_key = self_num_key. wrapping_add ( 1 ) ;
835835 }
836- if is_match_found == 0 && dictionary. is_some ( ) {
836+ if ! is_match_found && dictionary. is_some ( ) {
837837 let ( _, cur_data) = data. split_at ( cur_ix_masked) ;
838838 is_match_found = SearchInStaticDictionary (
839839 dictionary. unwrap ( ) ,
@@ -844,10 +844,10 @@ impl<Alloc: alloc::Allocator<u16> + alloc::Allocator<u32>> AnyHasher for H9<Allo
844844 max_backward. wrapping_add ( gap) ,
845845 max_distance,
846846 out,
847- 0i32 ,
847+ false ,
848848 ) ;
849849 }
850- is_match_found != 0
850+ is_match_found
851851 }
852852
853853 fn Store ( & mut self , data : & [ u8 ] , mask : usize , ix : usize ) {
@@ -1665,7 +1665,7 @@ impl<
16651665 ) -> bool {
16661666 let opts = self . Opts ( ) ;
16671667 let cur_ix_masked: usize = cur_ix & ring_buffer_mask;
1668- let mut is_match_found: i32 = 0i32 ;
1668+ let mut is_match_found = false ;
16691669 let mut best_score: u64 = out. score ;
16701670 let mut best_len: usize = out. len ;
16711671 let mut i: usize ;
@@ -1707,7 +1707,7 @@ impl<
17071707 out. len = best_len;
17081708 out. distance = backward;
17091709 out. score = best_score;
1710- is_match_found = 1i32 ;
1710+ is_match_found = true ;
17111711 }
17121712 }
17131713 }
@@ -1763,7 +1763,7 @@ impl<
17631763 out. len = best_len;
17641764 out. distance = backward;
17651765 out. score = best_score;
1766- is_match_found = 1i32 ;
1766+ is_match_found = true ;
17671767 }
17681768 }
17691769 }
@@ -1772,7 +1772,7 @@ impl<
17721772 cur_ix as u32 ;
17731773 * num_ref_mut = num_ref_mut. wrapping_add ( 1 ) ;
17741774 }
1775- if is_match_found == 0 && dictionary. is_some ( ) {
1775+ if ! is_match_found && dictionary. is_some ( ) {
17761776 let ( _, cur_data) = data. split_at ( cur_ix_masked) ;
17771777 is_match_found = SearchInStaticDictionary (
17781778 dictionary. unwrap ( ) ,
@@ -1783,10 +1783,10 @@ impl<
17831783 max_backward. wrapping_add ( gap) ,
17841784 max_distance,
17851785 out,
1786- 0i32 ,
1786+ false ,
17871787 ) ;
17881788 }
1789- is_match_found != 0
1789+ is_match_found
17901790 }
17911791}
17921792
@@ -1936,19 +1936,19 @@ fn SearchInStaticDictionary<HasherType: AnyHasher>(
19361936 max_backward : usize ,
19371937 max_distance : usize ,
19381938 out : & mut HasherSearchResult ,
1939- shallow : i32 ,
1940- ) -> i32 {
1939+ shallow : bool ,
1940+ ) -> bool {
19411941 let mut key: usize ;
19421942 let mut i: usize ;
1943- let mut is_match_found: i32 = 0i32 ;
1943+ let mut is_match_found = false ;
19441944 let opts = handle. Opts ( ) ;
19451945 let xself: & mut Struct1 = handle. GetHasherCommon ( ) ;
19461946 if xself. dict_num_matches < xself. dict_num_lookups >> 7 {
1947- return 0i32 ;
1947+ return false ;
19481948 }
19491949 key = ( Hash14 ( data) << 1 ) as usize ; //FIXME: works for any kind of hasher??
19501950 i = 0usize ;
1951- while i < if shallow != 0 { 1u32 } else { 2u32 } as usize {
1951+ while i < if shallow { 1 } else { 2 } {
19521952 {
19531953 let item: usize = dictionary_hash[ key] as usize ;
19541954 xself. dict_num_lookups = xself. dict_num_lookups . wrapping_add ( 1 ) ;
@@ -1965,7 +1965,7 @@ fn SearchInStaticDictionary<HasherType: AnyHasher>(
19651965 ) ;
19661966 if item_matches != 0 {
19671967 xself. dict_num_matches = xself. dict_num_matches . wrapping_add ( 1 ) ;
1968- is_match_found = 1i32 ;
1968+ is_match_found = true ;
19691969 }
19701970 }
19711971 }
0 commit comments