File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -632,7 +632,7 @@ impl CompressorBuilder {
632632 let ignored_bits = entry. ignored_bits ;
633633
634634 // If the entry is valid, return the code
635- if !entry. is_unused ( ) && compare_masked ( word, entry. symbol . as_u64 ( ) , ignored_bits) {
635+ if !entry. is_unused ( ) && compare_masked ( word, entry. symbol . to_u64 ( ) , ignored_bits) {
636636 return entry. code ;
637637 }
638638
Original file line number Diff line number Diff line change @@ -65,8 +65,9 @@ impl Symbol {
6565 if len == 0 { 1 } else { len }
6666 }
6767
68+ /// Returns the Symbol's inner representation.
6869 #[ inline]
69- fn as_u64 ( self ) -> u64 {
70+ pub fn to_u64 ( self ) -> u64 {
7071 self . 0
7172 }
7273
@@ -303,7 +304,7 @@ impl<'a> Decompressor<'a> {
303304 ( $code: expr) => { {
304305 out_ptr
305306 . cast:: <u64 >( )
306- . write_unaligned( self . symbols. get_unchecked( $code as usize ) . as_u64 ( ) ) ;
307+ . write_unaligned( self . symbols. get_unchecked( $code as usize ) . to_u64 ( ) ) ;
307308 out_ptr = out_ptr. add( * self . lengths. get_unchecked( $code as usize ) as usize ) ;
308309 } } ;
309310 }
@@ -588,7 +589,7 @@ impl Compressor {
588589 // Now, downshift the `word` and the `entry` to see if they align.
589590 let ignored_bits = entry. ignored_bits ;
590591 if entry. code != Code :: UNUSED
591- && compare_masked ( word, entry. symbol . as_u64 ( ) , ignored_bits)
592+ && compare_masked ( word, entry. symbol . to_u64 ( ) , ignored_bits)
592593 {
593594 // Advance the input by the symbol length (variable) and the output by one code byte
594595 // SAFETY: out_ptr is not null.
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ impl LossyPHT {
7979 ///
8080 /// True if the symbol was inserted into the table, false if it was rejected due to collision.
8181 pub ( crate ) fn insert ( & mut self , symbol : Symbol , len : usize , code : u8 ) -> bool {
82- let prefix_3bytes = symbol. as_u64 ( ) & 0xFF_FF_FF ;
82+ let prefix_3bytes = symbol. to_u64 ( ) & 0xFF_FF_FF ;
8383 let slot = fsst_hash ( prefix_3bytes) as usize & ( HASH_TABLE_SIZE - 1 ) ;
8484 let entry = & mut self . slots [ slot] ;
8585 if !entry. is_unused ( ) {
@@ -106,7 +106,7 @@ impl LossyPHT {
106106
107107 /// Remove the symbol from the hashtable, if it exists.
108108 pub ( crate ) fn remove ( & mut self , symbol : Symbol ) {
109- let prefix_3bytes = symbol. as_u64 ( ) & 0xFF_FF_FF ;
109+ let prefix_3bytes = symbol. to_u64 ( ) & 0xFF_FF_FF ;
110110 let slot = fsst_hash ( prefix_3bytes) as usize & ( HASH_TABLE_SIZE - 1 ) ;
111111 self . slots [ slot] . code = Code :: UNUSED ;
112112 }
You can’t perform that action at this time.
0 commit comments