@@ -16,21 +16,14 @@ use super::static_dict::{
1616use super :: util:: { floatX, Log2FloorNonZero } ;
1717use core:: cmp:: { max, min} ;
1818
19- static kBrotliMinWindowBits: i32 = 10i32 ;
20-
21- static kBrotliMaxWindowBits: i32 = 24i32 ;
22-
23- pub static kInvalidMatch: u32 = 0xfffffffu32 ;
24-
25- static kCutoffTransformsCount: u32 = 10u32 ;
26-
27- static kCutoffTransforms: u64 = 0x71b520au64 << 32 | 0xda2d3200u32 as ( u64 ) ;
28-
29- pub static kHashMul32: u32 = 0x1e35a7bdu32 ;
30-
31- pub static kHashMul64: u64 = 0x1e35a7bdu64 << 32 | 0x1e35a7bdu64 ;
32-
33- pub static kHashMul64Long: u64 = 0x1fe35a7bu32 as ( u64 ) << 32 | 0xd3579bd3u32 as ( u64 ) ;
19+ static kBrotliMinWindowBits: i32 = 10 ;
20+ static kBrotliMaxWindowBits: i32 = 24 ;
21+ pub static kInvalidMatch: u32 = 0x0fff_ffff ;
22+ static kCutoffTransformsCount: u32 = 10 ;
23+ static kCutoffTransforms: u64 = 0x071b_520a_da2d_3200 ;
24+ pub static kHashMul32: u32 = 0x1e35_a7bd ;
25+ pub static kHashMul64: u64 = 0x1e35_a7bd_1e35_a7bd ;
26+ pub static kHashMul64Long: u64 = 0x1fe3_5a7b_d357_9bd3 ;
3427
3528#[ derive( PartialEq , Eq , Copy , Clone , Debug ) ]
3629#[ repr( C ) ]
@@ -946,8 +939,8 @@ impl AdvHashSpecialization for HQ5Sub {
946939 }
947940 #[ inline( always) ]
948941 fn get_hash_mask ( & self ) -> u64 {
949- //return 0xffffffffffffffffu64 ;
950- 0xffffffffu64 // make it 32 bit
942+ //return 0xffff_ffff_ffff_ffff ;
943+ 0xffff_ffff // make it 32 bit
951944 }
952945 #[ inline( always) ]
953946 fn get_k_hash_mul ( & self ) -> u64 {
@@ -993,8 +986,8 @@ impl AdvHashSpecialization for HQ7Sub {
993986 }
994987 #[ inline( always) ]
995988 fn get_hash_mask ( & self ) -> u64 {
996- //return 0xffffffffffffffffu64 ;
997- 0xffffffffu64 // make it 32 bit
989+ //return 0xffff_ffff_ffff_ffff ;
990+ 0xffff_ffff // make it 32 bit
998991 }
999992 #[ inline( always) ]
1000993 fn get_k_hash_mul ( & self ) -> u64 {
@@ -1041,8 +1034,8 @@ impl AdvHashSpecialization for H5Sub {
10411034 self . block_mask_
10421035 }
10431036 fn get_hash_mask ( & self ) -> u64 {
1044- //return 0xffffffffffffffffu64 ;
1045- 0xffffffffu64 // make it 32 bit
1037+ //return 0xffff_ffff_ffff_ffff ;
1038+ 0xffff_ffff // make it 32 bit
10461039 }
10471040 fn get_k_hash_mul ( & self ) -> u64 {
10481041 kHashMul32 as u64
@@ -1115,7 +1108,8 @@ impl AdvHashSpecialization for H6Sub {
11151108}
11161109
11171110fn BackwardReferencePenaltyUsingLastDistance ( distance_short_code : usize ) -> u64 {
1118- ( 39u64 ) . wrapping_add ( ( 0x1ca10u64 >> ( distance_short_code & 0xeusize ) & 0xeu64 ) )
1111+ // FIXME?: double bitwise AND with the same value?
1112+ ( 39u64 ) . wrapping_add ( ( 0x0001_ca10_u64 >> ( distance_short_code & 0x0e ) & 0x0e ) )
11191113}
11201114
11211115impl <
@@ -1146,7 +1140,7 @@ impl<
11461140 let chunk_count = ( ix_end - ix_start) / 4 ;
11471141 for chunk_id in 0 ..chunk_count {
11481142 let i = ( ix_start + chunk_id * 4 ) & mask;
1149- let ffffffff = 0xffffffff ;
1143+ let ffffffff = 0xffff_ffff ;
11501144 let word = u64:: from ( data[ i] )
11511145 | ( u64:: from ( data[ i + 1 ] ) << 8 )
11521146 | ( u64:: from ( data[ i + 2 ] ) << 16 )
@@ -1229,7 +1223,7 @@ impl<
12291223 ) ;
12301224 for quad_index in 0 ..( REG_SIZE >> 2 ) {
12311225 let i = quad_index << 2 ;
1232- let ffffffff = 0xffffffff ;
1226+ let ffffffff = 0xffff_ffff ;
12331227 let word = u64:: from ( data64[ i] )
12341228 | ( u64:: from ( data64[ i + 1 ] ) << 8 )
12351229 | ( u64:: from ( data64[ i + 2 ] ) << 16 )
@@ -1311,7 +1305,7 @@ impl<
13111305 . clone_from_slice ( data. split_at ( ix_offset) . 1 . split_at ( REG_SIZE + lookahead4) . 0 ) ;
13121306 for quad_index in 0 ..( REG_SIZE >> 2 ) {
13131307 let i = quad_index << 2 ;
1314- let ffffffff = 0xffffffff ;
1308+ let ffffffff = 0xffff_ffff ;
13151309 let word = u64:: from ( data64[ i] )
13161310 | ( u64:: from ( data64[ i + 1 ] ) << 8 )
13171311 | ( u64:: from ( data64[ i + 2 ] ) << 16 )
@@ -1505,13 +1499,13 @@ impl<
15051499 | ( u64:: from ( data[ li + 7 ] ) << 56 ) ;
15061500 let hi = ( ix + 8 ) & mask;
15071501 let hword = u64:: from ( data[ hi] ) | ( u64:: from ( data[ hi + 1 ] ) << 8 ) ;
1508- let mixed0 = ( ( ( ( lword & 0xffffffff ) * self . specialization . get_k_hash_mul ( ) )
1502+ let mixed0 = ( ( ( ( lword & 0xffff_ffff ) * self . specialization . get_k_hash_mul ( ) )
15091503 & self . specialization . get_hash_mask ( ) )
15101504 >> shift) as usize ;
1511- let mixed1 = ( ( ( ( ( lword >> 16 ) & 0xffffffff ) * self . specialization . get_k_hash_mul ( ) )
1505+ let mixed1 = ( ( ( ( ( lword >> 16 ) & 0xffff_ffff ) * self . specialization . get_k_hash_mul ( ) )
15121506 & self . specialization . get_hash_mask ( ) )
15131507 >> shift) as usize ;
1514- let mixed2 = ( ( ( ( ( lword >> 32 ) & 0xffffffff ) * self . specialization . get_k_hash_mul ( ) )
1508+ let mixed2 = ( ( ( ( ( lword >> 32 ) & 0xffff_ffff ) * self . specialization . get_k_hash_mul ( ) )
15151509 & self . specialization . get_hash_mask ( ) )
15161510 >> shift) as usize ;
15171511 let mixed3 = ( ( ( ( ( ( hword & 0xffff ) << 16 ) | ( ( lword >> 48 ) & 0xffff ) )
0 commit comments