@@ -35,41 +35,12 @@ unsafe extern "C" fn ZSTD_countLeadingZeros32(mut val: u32) -> core::ffi::c_uint
3535}
3636#[ inline]
3737unsafe extern "C" fn ZSTD_highbit32 ( mut val : u32 ) -> core:: ffi:: c_uint {
38- ( 31 as core:: ffi:: c_int as core :: ffi :: c_uint ) . wrapping_sub ( ZSTD_countLeadingZeros32 ( val) )
38+ ( 31 as core:: ffi:: c_uint ) . wrapping_sub ( ZSTD_countLeadingZeros32 ( val) )
3939}
4040static BIT_mask : [ core:: ffi:: c_uint ; 32 ] = [
41- 0 as core:: ffi:: c_int as core:: ffi:: c_uint ,
42- 1 as core:: ffi:: c_int as core:: ffi:: c_uint ,
43- 3 as core:: ffi:: c_int as core:: ffi:: c_uint ,
44- 7 as core:: ffi:: c_int as core:: ffi:: c_uint ,
45- 0xf as core:: ffi:: c_int as core:: ffi:: c_uint ,
46- 0x1f as core:: ffi:: c_int as core:: ffi:: c_uint ,
47- 0x3f as core:: ffi:: c_int as core:: ffi:: c_uint ,
48- 0x7f as core:: ffi:: c_int as core:: ffi:: c_uint ,
49- 0xff as core:: ffi:: c_int as core:: ffi:: c_uint ,
50- 0x1ff as core:: ffi:: c_int as core:: ffi:: c_uint ,
51- 0x3ff as core:: ffi:: c_int as core:: ffi:: c_uint ,
52- 0x7ff as core:: ffi:: c_int as core:: ffi:: c_uint ,
53- 0xfff as core:: ffi:: c_int as core:: ffi:: c_uint ,
54- 0x1fff as core:: ffi:: c_int as core:: ffi:: c_uint ,
55- 0x3fff as core:: ffi:: c_int as core:: ffi:: c_uint ,
56- 0x7fff as core:: ffi:: c_int as core:: ffi:: c_uint ,
57- 0xffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
58- 0x1ffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
59- 0x3ffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
60- 0x7ffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
61- 0xfffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
62- 0x1fffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
63- 0x3fffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
64- 0x7fffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
65- 0xffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
66- 0x1ffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
67- 0x3ffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
68- 0x7ffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
69- 0xfffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
70- 0x1fffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
71- 0x3fffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
72- 0x7fffffff as core:: ffi:: c_int as core:: ffi:: c_uint ,
41+ 0 , 1 , 3 , 7 , 0xf , 0x1f , 0x3f , 0x7f , 0xff , 0x1ff , 0x3ff , 0x7ff , 0xfff , 0x1fff , 0x3fff , 0x7fff ,
42+ 0xffff , 0x1ffff , 0x3ffff , 0x7ffff , 0xfffff , 0x1fffff , 0x3fffff , 0x7fffff , 0xffffff , 0x1ffffff ,
43+ 0x3ffffff , 0x7ffffff , 0xfffffff , 0x1fffffff , 0x3fffffff , 0x7fffffff ,
7344] ;
7445#[ inline]
7546unsafe extern "C" fn BIT_initCStream (
@@ -273,8 +244,8 @@ pub unsafe extern "C" fn FSE_buildCTable_wksp(
273244 if highThreshold == tableSize. wrapping_sub ( 1 ) {
274245 let spread = tableSymbol. offset ( tableSize as isize ) ;
275246 let add = 0x101010101010101 as core:: ffi:: c_ulonglong as u64 ;
276- let mut pos = 0 as core :: ffi :: c_int as size_t ;
277- let mut sv = 0 as core :: ffi :: c_int as u64 ;
247+ let mut pos = 0 as size_t ;
248+ let mut sv = 0u64 ;
278249 let mut s: u32 = 0 ;
279250 s = 0 ;
280251 while s < maxSV1 {
@@ -293,7 +264,7 @@ pub unsafe extern "C" fn FSE_buildCTable_wksp(
293264 s = s. wrapping_add ( 1 ) ;
294265 sv = sv. wrapping_add ( add) ;
295266 }
296- let mut position = 0 as core :: ffi :: c_int as size_t ;
267+ let mut position = 0 as size_t ;
297268 let mut s_0: size_t = 0 ;
298269 let unroll = 2 ;
299270 s_0 = 0 ;
@@ -310,7 +281,7 @@ pub unsafe extern "C" fn FSE_buildCTable_wksp(
310281 s_0 = s_0. wrapping_add ( unroll) ;
311282 }
312283 } else {
313- let mut position_0 = 0 as core :: ffi :: c_int as u32 ;
284+ let mut position_0 = 0u32 ;
314285 let mut symbol: u32 = 0 ;
315286 symbol = 0 ;
316287 while symbol < maxSV1 {
@@ -338,7 +309,7 @@ pub unsafe extern "C" fn FSE_buildCTable_wksp(
338309 * tableU16. offset ( fresh2 as isize ) = tableSize. wrapping_add ( u_1) as u16 ;
339310 u_1 = u_1. wrapping_add ( 1 ) ;
340311 }
341- let mut total = 0 as core:: ffi:: c_int as core :: ffi :: c_uint ;
312+ let mut total = 0 as core:: ffi:: c_uint ;
342313 let mut s_2: core:: ffi:: c_uint = 0 ;
343314 s_2 = 0 ;
344315 while s_2 <= maxSymbolValue {
@@ -593,7 +564,7 @@ unsafe extern "C" fn FSE_normalizeM2(
593564) -> size_t {
594565 let NOT_YET_ASSIGNED = -( 2 ) as core:: ffi:: c_short ;
595566 let mut s: u32 = 0 ;
596- let mut distributed = 0 as core :: ffi :: c_int as u32 ;
567+ let mut distributed = 0u32 ;
597568 let mut ToDistribute : u32 = 0 ;
598569 let lowThreshold = ( total >> tableLog) as u32 ;
599570 let mut lowOne = ( ( total * 3 ) >> tableLog. wrapping_add ( 1 ) ) as u32 ;
@@ -614,7 +585,7 @@ unsafe extern "C" fn FSE_normalizeM2(
614585 }
615586 s = s. wrapping_add ( 1 ) ;
616587 }
617- ToDistribute = ( ( ( 1 ) << tableLog) as u32 ) . wrapping_sub ( distributed) ;
588+ ToDistribute = ( ( 1 << tableLog) as u32 ) . wrapping_sub ( distributed) ;
618589 if ToDistribute == 0 {
619590 return 0 ;
620591 }
@@ -631,7 +602,7 @@ unsafe extern "C" fn FSE_normalizeM2(
631602 }
632603 s = s. wrapping_add ( 1 ) ;
633604 }
634- ToDistribute = ( ( ( 1 ) << tableLog) as u32 ) . wrapping_sub ( distributed) ;
605+ ToDistribute = ( ( 1 << tableLog) as u32 ) . wrapping_sub ( distributed) ;
635606 }
636607 if distributed == maxSymbolValue. wrapping_add ( 1 ) {
637608 let mut maxV = 0 ;
@@ -662,10 +633,9 @@ unsafe extern "C" fn FSE_normalizeM2(
662633 }
663634 return 0 ;
664635 }
665- let vStepLog = ( 62 as core:: ffi:: c_int as u32 ) . wrapping_sub ( tableLog) as u64 ;
666- let mid = ( ( 1 as core:: ffi:: c_ulonglong ) << vStepLog. wrapping_sub ( 1 as core:: ffi:: c_int as u64 ) )
667- . wrapping_sub ( 1 as core:: ffi:: c_int as core:: ffi:: c_ulonglong ) as u64 ;
668- let rStep = ( ( ( 1 ) << vStepLog) * ToDistribute as u64 ) . wrapping_add ( mid) / total as u32 as u64 ;
636+ let vStepLog = 62u32 . wrapping_sub ( tableLog) as u64 ;
637+ let mid = ( ( 1 as core:: ffi:: c_ulonglong ) << vStepLog. wrapping_sub ( 1 ) ) . wrapping_sub ( 1 ) as u64 ;
638+ let rStep = ( ( 1 << vStepLog) * ToDistribute as u64 ) . wrapping_add ( mid) / total as u32 as u64 ;
669639 let mut tmpTotal = mid;
670640 s = 0 ;
671641 while s <= maxSymbolValue {
@@ -707,9 +677,9 @@ pub unsafe extern "C" fn FSE_normalizeCount(
707677 }
708678 static rtbTable: [ u32 ; 8 ] = [ 0 , 473195 , 504333 , 520860 , 550000 , 700000 , 750000 , 830000 ] ;
709679 let lowProbCount = ( if useLowProbCount != 0 { -( 1 ) } else { 1 } ) as core:: ffi:: c_short ;
710- let scale = ( 62 as core:: ffi:: c_int as core :: ffi :: c_uint ) . wrapping_sub ( tableLog) as u64 ;
711- let step = ( ( 1 ) << 62 ) / total as u32 as u64 ;
712- let vStep = ( ( 1 ) << scale. wrapping_sub ( 20 ) ) as u64 ;
680+ let scale = ( 62 as core:: ffi:: c_uint ) . wrapping_sub ( tableLog) as u64 ;
681+ let step = ( 1 << 62 ) / total as u32 as u64 ;
682+ let vStep = ( 1 << scale. wrapping_sub ( 20 ) ) as u64 ;
713683 let mut stillToDistribute = ( 1 ) << tableLog;
714684 let mut s: core:: ffi:: c_uint = 0 ;
715685 let mut largest = 0 ;
0 commit comments