@@ -299,14 +299,14 @@ unsafe fn BITv06_initDStream(
299299
300300#[ inline]
301301unsafe fn BITv06_lookBits ( bitD : * const BITv06_DStream_t , nbBits : u32 ) -> size_t {
302- let bitMask = size_of :: < size_t > ( ) . wrapping_mul ( 8 ) . wrapping_sub ( 1 ) as u32 ;
302+ let bitMask = size_t :: BITS - 1 ;
303303 ( * bitD) . bitContainer << ( ( * bitD) . bitsConsumed & bitMask)
304304 >> 1
305305 >> ( bitMask. wrapping_sub ( nbBits) & bitMask)
306306}
307307#[ inline]
308308unsafe fn BITv06_lookBitsFast ( bitD : * const BITv06_DStream_t , nbBits : u32 ) -> size_t {
309- let bitMask = size_of :: < size_t > ( ) . wrapping_mul ( 8 ) . wrapping_sub ( 1 ) as u32 ;
309+ let bitMask = size_t :: BITS - 1 ;
310310 ( * bitD) . bitContainer << ( ( * bitD) . bitsConsumed & bitMask)
311311 >> ( bitMask. wrapping_add ( 1 ) . wrapping_sub ( nbBits) & bitMask)
312312}
@@ -328,7 +328,7 @@ unsafe fn BITv06_readBitsFast(bitD: *mut BITv06_DStream_t, nbBits: u32) -> size_
328328}
329329#[ inline]
330330unsafe fn BITv06_reloadDStream ( bitD : * mut BITv06_DStream_t ) -> BITv06_DStream_status {
331- if ( * bitD) . bitsConsumed as size_t > size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
331+ if ( * bitD) . bitsConsumed > size_t :: BITS {
332332 return BITv06_DStream_overflow ;
333333 }
334334 if ( * bitD) . ptr >= ( ( * bitD) . start ) . add ( size_of :: < size_t > ( ) ) {
@@ -338,7 +338,7 @@ unsafe fn BITv06_reloadDStream(bitD: *mut BITv06_DStream_t) -> BITv06_DStream_st
338338 return BITv06_DStream_unfinished ;
339339 }
340340 if ( * bitD) . ptr == ( * bitD) . start {
341- if ( ( * bitD) . bitsConsumed as size_t ) < size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
341+ if ( * bitD) . bitsConsumed < size_t :: BITS {
342342 return BITv06_DStream_endOfBuffer ;
343343 }
344344 return BITv06_DStream_completed ;
@@ -356,8 +356,7 @@ unsafe fn BITv06_reloadDStream(bitD: *mut BITv06_DStream_t) -> BITv06_DStream_st
356356}
357357#[ inline]
358358unsafe fn BITv06_endOfDStream ( DStream : * const BITv06_DStream_t ) -> core:: ffi:: c_uint {
359- ( ( * DStream ) . ptr == ( * DStream ) . start
360- && ( * DStream ) . bitsConsumed as size_t == size_of :: < size_t > ( ) . wrapping_mul ( 8 ) )
359+ ( ( * DStream ) . ptr == ( * DStream ) . start && ( * DStream ) . bitsConsumed == size_t:: BITS )
361360 as core:: ffi:: c_int as core:: ffi:: c_uint
362361}
363362#[ inline]
@@ -677,15 +676,15 @@ unsafe fn FSEv06_decompress_usingDTable_generic(
677676 } else {
678677 FSEv06_decodeSymbol ( & mut state1, & mut bitD) as core:: ffi:: c_int
679678 } ) as u8 ;
680- if ( FSEv06_MAX_TABLELOG * 2 + 7 ) as size_t > size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
679+ if FSEv06_MAX_TABLELOG * 2 + 7 > size_t:: BITS as core :: ffi :: c_int {
681680 BITv06_reloadDStream ( & mut bitD) ;
682681 }
683682 * op. add ( 1 ) = ( if fast != 0 {
684683 FSEv06_decodeSymbolFast ( & mut state2, & mut bitD) as core:: ffi:: c_int
685684 } else {
686685 FSEv06_decodeSymbol ( & mut state2, & mut bitD) as core:: ffi:: c_int
687686 } ) as u8 ;
688- if ( FSEv06_MAX_TABLELOG * 4 + 7 ) as size_t > size_of :: < size_t > ( ) . wrapping_mul ( 8 )
687+ if FSEv06_MAX_TABLELOG * 4 + 7 > size_t:: BITS as core :: ffi :: c_int
689688 && BITv06_reloadDStream ( & mut bitD) as core:: ffi:: c_uint
690689 > BITv06_DStream_unfinished as core:: ffi:: c_int as core:: ffi:: c_uint
691690 {
@@ -697,7 +696,7 @@ unsafe fn FSEv06_decompress_usingDTable_generic(
697696 } else {
698697 FSEv06_decodeSymbol ( & mut state1, & mut bitD) as core:: ffi:: c_int
699698 } ) as u8 ;
700- if ( FSEv06_MAX_TABLELOG * 2 + 7 ) as size_t > size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
699+ if FSEv06_MAX_TABLELOG * 2 + 7 > size_t:: BITS as std :: ffi :: c_int {
701700 BITv06_reloadDStream ( & mut bitD) ;
702701 }
703702 * op. add ( 3 ) = ( if fast != 0 {
@@ -1561,10 +1560,10 @@ unsafe fn HUFv06_decodeLastSymbolX4(
15611560 memcpy ( op, dt. add ( val) as * const core:: ffi:: c_void , 1 ) ;
15621561 if ( * dt. add ( val) ) . length as core:: ffi:: c_int == 1 {
15631562 BITv06_skipBits ( DStream , ( * dt. add ( val) ) . nbBits as u32 ) ;
1564- } else if ( ( * DStream ) . bitsConsumed as size_t ) < size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
1563+ } else if ( * DStream ) . bitsConsumed < size_t :: BITS {
15651564 BITv06_skipBits ( DStream , ( * dt. add ( val) ) . nbBits as u32 ) ;
1566- if ( * DStream ) . bitsConsumed as size_t > size_of :: < size_t > ( ) . wrapping_mul ( 8 ) {
1567- ( * DStream ) . bitsConsumed = size_of :: < size_t > ( ) . wrapping_mul ( 8 ) as core :: ffi :: c_uint ;
1565+ if ( * DStream ) . bitsConsumed > size_t :: BITS {
1566+ ( * DStream ) . bitsConsumed = size_t:: BITS ;
15681567 }
15691568 }
15701569 1
0 commit comments