@@ -16,21 +16,14 @@ use super::static_dict::{
16
16
use super :: util:: { floatX, Log2FloorNonZero } ;
17
17
use core:: cmp:: { max, min} ;
18
18
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 ;
34
27
35
28
#[ derive( PartialEq , Eq , Copy , Clone , Debug ) ]
36
29
#[ repr( C ) ]
@@ -946,8 +939,8 @@ impl AdvHashSpecialization for HQ5Sub {
946
939
}
947
940
#[ inline( always) ]
948
941
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
951
944
}
952
945
#[ inline( always) ]
953
946
fn get_k_hash_mul ( & self ) -> u64 {
@@ -993,8 +986,8 @@ impl AdvHashSpecialization for HQ7Sub {
993
986
}
994
987
#[ inline( always) ]
995
988
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
998
991
}
999
992
#[ inline( always) ]
1000
993
fn get_k_hash_mul ( & self ) -> u64 {
@@ -1041,8 +1034,8 @@ impl AdvHashSpecialization for H5Sub {
1041
1034
self . block_mask_
1042
1035
}
1043
1036
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
1046
1039
}
1047
1040
fn get_k_hash_mul ( & self ) -> u64 {
1048
1041
kHashMul32 as u64
@@ -1115,7 +1108,8 @@ impl AdvHashSpecialization for H6Sub {
1115
1108
}
1116
1109
1117
1110
fn 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 ) )
1119
1113
}
1120
1114
1121
1115
impl <
@@ -1146,7 +1140,7 @@ impl<
1146
1140
let chunk_count = ( ix_end - ix_start) / 4 ;
1147
1141
for chunk_id in 0 ..chunk_count {
1148
1142
let i = ( ix_start + chunk_id * 4 ) & mask;
1149
- let ffffffff = 0xffffffff ;
1143
+ let ffffffff = 0xffff_ffff ;
1150
1144
let word = u64:: from ( data[ i] )
1151
1145
| ( u64:: from ( data[ i + 1 ] ) << 8 )
1152
1146
| ( u64:: from ( data[ i + 2 ] ) << 16 )
@@ -1229,7 +1223,7 @@ impl<
1229
1223
) ;
1230
1224
for quad_index in 0 ..( REG_SIZE >> 2 ) {
1231
1225
let i = quad_index << 2 ;
1232
- let ffffffff = 0xffffffff ;
1226
+ let ffffffff = 0xffff_ffff ;
1233
1227
let word = u64:: from ( data64[ i] )
1234
1228
| ( u64:: from ( data64[ i + 1 ] ) << 8 )
1235
1229
| ( u64:: from ( data64[ i + 2 ] ) << 16 )
@@ -1311,7 +1305,7 @@ impl<
1311
1305
. clone_from_slice ( data. split_at ( ix_offset) . 1 . split_at ( REG_SIZE + lookahead4) . 0 ) ;
1312
1306
for quad_index in 0 ..( REG_SIZE >> 2 ) {
1313
1307
let i = quad_index << 2 ;
1314
- let ffffffff = 0xffffffff ;
1308
+ let ffffffff = 0xffff_ffff ;
1315
1309
let word = u64:: from ( data64[ i] )
1316
1310
| ( u64:: from ( data64[ i + 1 ] ) << 8 )
1317
1311
| ( u64:: from ( data64[ i + 2 ] ) << 16 )
@@ -1505,13 +1499,13 @@ impl<
1505
1499
| ( u64:: from ( data[ li + 7 ] ) << 56 ) ;
1506
1500
let hi = ( ix + 8 ) & mask;
1507
1501
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 ( ) )
1509
1503
& self . specialization . get_hash_mask ( ) )
1510
1504
>> 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 ( ) )
1512
1506
& self . specialization . get_hash_mask ( ) )
1513
1507
>> 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 ( ) )
1515
1509
& self . specialization . get_hash_mask ( ) )
1516
1510
>> shift) as usize ;
1517
1511
let mixed3 = ( ( ( ( ( ( hword & 0xffff ) << 16 ) | ( ( lword >> 48 ) & 0xffff ) )
0 commit comments