File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
ipld/bitfield/src/rleplus Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ impl<'a> BitReader<'a> {
45
45
46
46
/// Peeks a given number of bits from the buffer.Will keep returning 0 once
47
47
/// the buffer has been exhausted.
48
+ #[ inline( always) ]
48
49
pub fn peek ( & self , num_bits : u32 ) -> u8 {
49
50
debug_assert ! ( num_bits <= 8 ) ;
50
51
@@ -55,6 +56,7 @@ impl<'a> BitReader<'a> {
55
56
}
56
57
57
58
/// Drops a number of bits from the buffer
59
+ #[ inline( always) ]
58
60
pub fn drop ( & mut self , num_bits : u32 ) {
59
61
debug_assert ! ( num_bits <= 8 ) ;
60
62
@@ -64,7 +66,7 @@ impl<'a> BitReader<'a> {
64
66
65
67
// not sure why this being outside of the if improves the performance
66
68
// bit it does, probably related to keeping caches warm
67
- let byte = self . bytes . get ( 0 ) . unwrap_or ( & 0 ) ;
69
+ let byte = self . bytes . first ( ) . unwrap_or ( & 0 ) ;
68
70
self . bits |= ( * byte as u64 ) << self . num_bits ;
69
71
70
72
// if fewer than 8 bits remain, we skip to loading the next byte
You can’t perform that action at this time.
0 commit comments