1111
1212use std:: io:: Cursor ;
1313
14+ use bytemuck:: cast_slice_mut;
1415use fastpfor:: rust:: { BLOCK_SIZE_128 , DEFAULT_PAGE_SIZE , FastPFOR , Integer , Skippable } ;
1516
1617// ── helpers ──────────────────────────────────────────────────────────────────
@@ -229,7 +230,7 @@ fn decode_exception_partial_group_not_enough_data() {
229230fn decode_block_b_too_large ( ) {
230231 let ( mut compressed, _) = compressed_with_exceptions ( ) ;
231232 let start = meta_byte_start ( & compressed) ;
232- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut compressed) ;
233+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut compressed) ;
233234 bytes[ start] = 33 ; // overwrite best_b of block 0
234235 assert ! ( try_decode( & compressed) . is_err( ) ) ;
235236}
@@ -289,7 +290,7 @@ fn find_exception_block(bytes: &[u8], meta_start: usize) -> Option<(usize, usize
289290fn decode_exception_maxbits_too_large ( ) {
290291 let ( mut compressed, _) = compressed_with_exceptions ( ) ;
291292 let start = meta_byte_start ( & compressed) ;
292- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut compressed) ;
293+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut compressed) ;
293294 if let Some ( ( _, _, mb_off) ) = find_exception_block ( bytes, start) {
294295 bytes[ mb_off] = 33 ;
295296 }
@@ -301,7 +302,7 @@ fn decode_exception_maxbits_too_large() {
301302fn decode_exception_index_underflow ( ) {
302303 let ( mut compressed, _) = compressed_with_exceptions ( ) ;
303304 let start = meta_byte_start ( & compressed) ;
304- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut compressed) ;
305+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut compressed) ;
305306 if let Some ( ( bb_off, _, mb_off) ) = find_exception_block ( bytes, start) {
306307 bytes[ mb_off] = bytes[ bb_off] . saturating_sub ( 1 ) ; // maxbits < best_b
307308 }
@@ -313,7 +314,7 @@ fn decode_exception_index_underflow() {
313314fn decode_exception_index_zero ( ) {
314315 let ( mut compressed, _) = compressed_with_exceptions ( ) ;
315316 let start = meta_byte_start ( & compressed) ;
316- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut compressed) ;
317+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut compressed) ;
317318 if let Some ( ( bb_off, _, mb_off) ) = find_exception_block ( bytes, start) {
318319 bytes[ mb_off] = bytes[ bb_off] ; // maxbits == best_b → index 0
319320 }
@@ -368,7 +369,7 @@ fn decode_index1_pos_out_of_block() {
368369 buf. truncate ( out_off. position ( ) as usize ) ;
369370
370371 let start = meta_byte_start ( & buf) ;
371- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut buf) ;
372+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut buf) ;
372373 if let Some ( ( bb_off, _, mb_off) ) = find_exception_block ( bytes, start) {
373374 if bytes[ mb_off] . wrapping_sub ( bytes[ bb_off] ) == 1 && mb_off + 1 < bytes. len ( ) {
374375 bytes[ mb_off + 1 ] = 200 ; // position 200 >= block_size 128
@@ -432,7 +433,7 @@ fn decode_exception_pos_out_of_block() {
432433 buf. truncate ( out_off. position ( ) as usize ) ;
433434
434435 let start = meta_byte_start ( & buf) ;
435- let bytes: & mut [ u8 ] = bytemuck :: cast_slice_mut ( & mut buf) ;
436+ let bytes: & mut [ u8 ] = cast_slice_mut ( & mut buf) ;
436437 if let Some ( ( bb_off, _, mb_off) ) = find_exception_block ( bytes, start) {
437438 if bytes[ mb_off] . wrapping_sub ( bytes[ bb_off] ) > 1 && mb_off + 1 < bytes. len ( ) {
438439 bytes[ mb_off + 1 ] = 200 ; // position 200 >= block_size 128
0 commit comments