@@ -167,15 +167,15 @@ pub struct BrotliEncoderStateStruct<AllocU8: alloc::Allocator<u8>,
167
167
pub m32 : AllocU32 ,
168
168
pub mc : AllocCommand ,
169
169
pub hasher_ : UnionHasher < AllocU16 , AllocU32 > ,
170
- pub input_pos_ : usize ,
170
+ pub input_pos_ : u64 ,
171
171
pub ringbuffer_ : RingBuffer < AllocU8 > ,
172
172
pub cmd_alloc_size_ : usize ,
173
173
pub commands_ : AllocCommand :: AllocatedMemory , // not sure about this one
174
174
pub num_commands_ : usize ,
175
175
pub num_literals_ : usize ,
176
176
pub last_insert_len_ : usize ,
177
- pub last_flush_pos_ : usize ,
178
- pub last_processed_pos_ : usize ,
177
+ pub last_flush_pos_ : u64 ,
178
+ pub last_processed_pos_ : u64 ,
179
179
pub dist_cache_ : [ i32 ; 16 ] ,
180
180
pub saved_dist_cache_ : [ i32 ; kNumDistanceCacheEntries] ,
181
181
pub last_byte_ : u8 ,
@@ -317,12 +317,12 @@ pub fn BrotliEncoderCreateInstance<AllocU8: alloc::Allocator<u8>,
317
317
let cache: [ i32 ; 16 ] = [ 4 , 11 , 15 , 16 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
318
318
BrotliEncoderStateStruct :: < AllocU8 , AllocU16 , AllocU32 , AllocI32 , AllocCommand > {
319
319
params : BrotliEncoderInitParams ( ) ,
320
- input_pos_ : 0usize ,
320
+ input_pos_ : 0 ,
321
321
num_commands_ : 0usize ,
322
322
num_literals_ : 0usize ,
323
323
last_insert_len_ : 0usize ,
324
- last_flush_pos_ : 0usize ,
325
- last_processed_pos_ : 0usize ,
324
+ last_flush_pos_ : 0 ,
325
+ last_processed_pos_ : 0 ,
326
326
prev_byte_ : 0i32 as ( u8 ) ,
327
327
prev_byte2_ : 0i32 as ( u8 ) ,
328
328
storage_size_ : 0usize ,
@@ -979,7 +979,7 @@ fn CopyInputToRingBuffer<AllocU8: alloc::Allocator<u8>,
979
979
if !( 0i32 == 0 ) {
980
980
return ;
981
981
}
982
- ( * s) . input_pos_ = ( * s) . input_pos_ . wrapping_add ( input_size) ;
982
+ ( * s) . input_pos_ = ( * s) . input_pos_ . wrapping_add ( input_size as u64 ) ;
983
983
if ( s. ringbuffer_ ) . pos_ <= ( s. ringbuffer_ ) . mask_ {
984
984
let start = ( ( s. ringbuffer_ ) . buffer_index . wrapping_add ( ( s. ringbuffer_ ) . pos_ as ( usize ) ) as
985
985
( usize ) ) ;
@@ -1292,9 +1292,9 @@ pub fn BrotliEncoderSetCustomDictionary<AllocU8: alloc::Allocator<u8>,
1292
1292
dict_size = max_dict_size;
1293
1293
}
1294
1294
CopyInputToRingBuffer ( s, dict_size, dict) ;
1295
- ( * s) . last_flush_pos_ = dict_size;
1296
- ( * s) . last_processed_pos_ = dict_size;
1297
- if dict_size > 0usize {
1295
+ ( * s) . last_flush_pos_ = dict_size as u64 ;
1296
+ ( * s) . last_processed_pos_ = dict_size as u64 ;
1297
+ if dict_size > 0 {
1298
1298
( * s) . prev_byte_ = dict[ ( dict_size. wrapping_sub ( 1usize ) as ( usize ) ) ] ;
1299
1299
}
1300
1300
if dict_size > 1usize {
@@ -1380,7 +1380,7 @@ fn InitInsertCommand(xself: &mut Command, insertlen: usize) {
1380
1380
1381
1381
fn ShouldCompress ( data : & [ u8 ] ,
1382
1382
mask : usize ,
1383
- last_flush_pos : usize ,
1383
+ last_flush_pos : u64 ,
1384
1384
bytes : usize ,
1385
1385
num_literals : usize ,
1386
1386
num_commands : usize )
@@ -2050,7 +2050,7 @@ fn UnprocessedInputSize<AllocU8: alloc::Allocator<u8>,
2050
2050
AllocU32 : alloc:: Allocator < u32 > ,
2051
2051
AllocI32 : alloc:: Allocator < i32 > ,
2052
2052
AllocCommand : alloc:: Allocator < Command > > (
2053
- s : & mut BrotliEncoderStateStruct < AllocU8 , AllocU16 , AllocU32 , AllocI32 , AllocCommand > ) -> usize {
2053
+ s : & mut BrotliEncoderStateStruct < AllocU8 , AllocU16 , AllocU32 , AllocI32 , AllocCommand > ) -> u64 {
2054
2054
( * s) . input_pos_ . wrapping_sub ( ( * s) . last_processed_pos_ )
2055
2055
}
2056
2056
@@ -2061,12 +2061,12 @@ fn UpdateSizeHint<AllocU8: alloc::Allocator<u8>,
2061
2061
AllocCommand : alloc:: Allocator < Command > > ( s : & mut BrotliEncoderStateStruct < AllocU8 , AllocU16 , AllocU32 , AllocI32 , AllocCommand > ,
2062
2062
available_in : usize ) {
2063
2063
if ( * s) . params . size_hint == 0usize {
2064
- let delta: usize = UnprocessedInputSize ( s) ;
2065
- let tail: usize = available_in;
2064
+ let delta: u64 = UnprocessedInputSize ( s) ;
2065
+ let tail: u64 = available_in as u64 ;
2066
2066
let limit: u32 = 1u32 << 30i32 ;
2067
2067
let total: u32 ;
2068
- if delta >= limit as ( usize ) || tail >= limit as ( usize ) ||
2069
- delta. wrapping_add ( tail) >= limit as ( usize ) {
2068
+ if delta >= u64 :: from ( limit ) || tail >= u64 :: from ( limit ) ||
2069
+ delta. wrapping_add ( tail) >= u64 :: from ( limit ) {
2070
2070
total = limit;
2071
2071
} else {
2072
2072
total = delta. wrapping_add ( tail) as ( u32 ) ;
@@ -2076,12 +2076,12 @@ fn UpdateSizeHint<AllocU8: alloc::Allocator<u8>,
2076
2076
}
2077
2077
2078
2078
2079
- fn WrapPosition ( position : usize ) -> u32 {
2079
+ fn WrapPosition ( position : u64 ) -> u32 {
2080
2080
let mut result: u32 = position as ( u32 ) ;
2081
- let gb: usize = position >> 30i32 ;
2082
- if gb > 2usize {
2081
+ let gb: u64 = position >> 30i32 ;
2082
+ if gb > 2 {
2083
2083
result = result & ( 1u32 << 30i32 ) . wrapping_sub ( 1u32 ) |
2084
- ( ( gb. wrapping_sub ( 1usize ) & 1usize ) as ( u32 ) ) . wrapping_add ( 1u32 ) << 30i32 ;
2084
+ ( ( gb. wrapping_sub ( 1 ) & 1 ) as ( u32 ) ) . wrapping_add ( 1u32 ) << 30i32 ;
2085
2085
}
2086
2086
result
2087
2087
}
@@ -2442,7 +2442,7 @@ fn WriteMetaBlockInternal<AllocU8: alloc::Allocator<u8>,
2442
2442
mht : & mut AllocHT ,
2443
2443
data : & [ u8 ] ,
2444
2444
mask : usize ,
2445
- last_flush_pos : usize ,
2445
+ last_flush_pos : u64 ,
2446
2446
bytes : usize ,
2447
2447
is_last : i32 ,
2448
2448
params : & BrotliEncoderParams ,
@@ -2670,7 +2670,7 @@ fn EncodeData<AllocU8: alloc::Allocator<u8>,
2670
2670
callback : & mut MetablockCallback
2671
2671
// mut output: &'a mut &'a mut [u8]
2672
2672
) -> i32 where MetablockCallback : FnMut ( & [ interface:: Command < InputReference > ] ) {
2673
- let delta: usize = UnprocessedInputSize ( s) ;
2673
+ let delta: u64 = UnprocessedInputSize ( s) ;
2674
2674
let bytes: u32 = delta as ( u32 ) ;
2675
2675
let wrapped_last_processed_pos: u32 = WrapPosition ( ( * s) . last_processed_pos_ ) ;
2676
2676
let mask: u32 ;
@@ -2685,7 +2685,7 @@ fn EncodeData<AllocU8: alloc::Allocator<u8>,
2685
2685
if is_last != 0 {
2686
2686
( * s) . is_last_block_emitted_ = 1i32 ;
2687
2687
}
2688
- if delta > InputBlockSize ( s) {
2688
+ if delta > InputBlockSize ( s) as u64 {
2689
2689
return 0i32 ;
2690
2690
}
2691
2691
if ( * s) . params . quality == 1i32 && ( * s) . command_buf_ . slice ( ) . len ( ) == 0 {
@@ -2699,7 +2699,7 @@ fn EncodeData<AllocU8: alloc::Allocator<u8>,
2699
2699
let mut table_size: usize = 0 ;
2700
2700
{
2701
2701
let table: & mut [ i32 ] ;
2702
- if delta == 0usize && ( is_last == 0 ) {
2702
+ if delta == 0 && ( is_last == 0 ) {
2703
2703
* out_size = 0usize ;
2704
2704
return 1i32 ;
2705
2705
}
@@ -2813,7 +2813,7 @@ fn EncodeData<AllocU8: alloc::Allocator<u8>,
2813
2813
let max_length: usize = MaxMetablockSize ( & mut ( * s) . params ) ;
2814
2814
let max_literals: usize = max_length. wrapping_div ( 8usize ) ;
2815
2815
let max_commands: usize = max_length. wrapping_div ( 8usize ) ;
2816
- let processed_bytes: usize = ( * s) . input_pos_ . wrapping_sub ( ( * s) . last_flush_pos_ ) ;
2816
+ let processed_bytes: usize = ( * s) . input_pos_ . wrapping_sub ( ( * s) . last_flush_pos_ ) as usize ;
2817
2817
let next_input_fits_metablock: i32 = if !!( processed_bytes. wrapping_add ( InputBlockSize ( s) ) <=
2818
2818
max_length) {
2819
2819
1i32
@@ -2886,12 +2886,12 @@ fn EncodeData<AllocU8: alloc::Allocator<u8>,
2886
2886
HasherReset ( & mut ( * s) . hasher_ ) ;
2887
2887
}
2888
2888
let data = & ( * s) . ringbuffer_ . data_mo . slice ( ) [ ( * s) . ringbuffer_ . buffer_index as usize ..] ;
2889
- if ( * s) . last_flush_pos_ > 0usize {
2889
+ if ( * s) . last_flush_pos_ > 0 {
2890
2890
( * s) . prev_byte_ = data[ ( ( ( ( * s) . last_flush_pos_ as ( u32 ) ) . wrapping_sub ( 1u32 ) & mask) as
2891
2891
( usize ) ) ] ;
2892
2892
}
2893
- if ( * s) . last_flush_pos_ > 1usize {
2894
- ( * s) . prev_byte2_ = data[ ( ( ( * s) . last_flush_pos_ . wrapping_sub ( 2usize ) as ( u32 ) & mask) as
2893
+ if ( * s) . last_flush_pos_ > 1 {
2894
+ ( * s) . prev_byte2_ = data[ ( ( ( * s) . last_flush_pos_ . wrapping_sub ( 2 ) as ( u32 ) & mask) as
2895
2895
( usize ) ) ] ;
2896
2896
}
2897
2897
( * s) . num_commands_ = 0usize ;
@@ -3246,12 +3246,12 @@ fn RemainingInputBlockSize<AllocU8: alloc::Allocator<u8>,
3246
3246
AllocU32 : alloc:: Allocator < u32 > ,
3247
3247
AllocI32 : alloc:: Allocator < i32 > ,
3248
3248
AllocCommand : alloc:: Allocator < Command > > ( s : & mut BrotliEncoderStateStruct < AllocU8 , AllocU16 , AllocU32 , AllocI32 , AllocCommand > ) -> usize {
3249
- let delta: usize = UnprocessedInputSize ( s) ;
3249
+ let delta: u64 = UnprocessedInputSize ( s) ;
3250
3250
let block_size: usize = InputBlockSize ( s) ;
3251
- if delta >= block_size {
3251
+ if delta >= block_size as u64 {
3252
3252
return 0usize ;
3253
3253
}
3254
- block_size. wrapping_sub ( delta)
3254
+ ( block_size as u64 ) . wrapping_sub ( delta) as usize
3255
3255
}
3256
3256
3257
3257
pub fn BrotliEncoderCompressStream < AllocU8 : alloc:: Allocator < u8 > ,
0 commit comments