File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ mod stream {
259259 }
260260
261261 // of course this uses big endian values
262- let read = unsafe { self . next_in . cast :: < u64 > ( ) . read_unaligned ( ) . to_be ( ) } ;
262+ let read = u64 :: from_be_bytes ( unsafe { self . next_in . cast :: < [ u8 ; 8 ] > ( ) . read ( ) } ) ;
263263
264264 // because of the endianness, we can only shift in whole bytes.
265265 // this calculates the number of available bits, rounded down to the nearest multiple
@@ -279,6 +279,9 @@ mod stream {
279279 Some ( ( bit_buffer, bits_used + increment_bits) )
280280 }
281281
282+ /// Read exactly 1 byte into the buffer
283+ ///
284+ /// The caller is responsible for updating `self.total_in`!
282285 #[ must_use]
283286 #[ inline( always) ]
284287 pub ( crate ) fn pull_u8 (
@@ -292,7 +295,7 @@ mod stream {
292295
293296 let read = unsafe { * ( self . next_in as * mut u8 ) } ;
294297 bit_buffer <<= 8 ;
295- bit_buffer |= read as u64 ;
298+ bit_buffer |= u64:: from ( read ) ;
296299
297300 self . next_in = unsafe { ( self . next_in ) . offset ( 1 ) } ;
298301 self . avail_in -= 1 ;
You can’t perform that action at this time.
0 commit comments