@@ -20,11 +20,11 @@ type GroupWord = u64;
2020) ) ]
2121type GroupWord = u32 ;
2222
23- pub type BitMaskWord = GroupWord ;
24- pub const BITMASK_STRIDE : usize = 8 ;
23+ pub ( crate ) type BitMaskWord = GroupWord ;
24+ pub ( crate ) const BITMASK_STRIDE : usize = 8 ;
2525// We only care about the highest bit of each byte for the mask.
2626#[ allow( clippy:: cast_possible_truncation, clippy:: unnecessary_cast) ]
27- pub const BITMASK_MASK : BitMaskWord = 0x8080_8080_8080_8080_u64 as GroupWord ;
27+ pub ( crate ) const BITMASK_MASK : BitMaskWord = 0x8080_8080_8080_8080_u64 as GroupWord ;
2828
2929/// Helper function to replicate a byte across a `GroupWord`.
3030#[ inline]
@@ -37,7 +37,7 @@ fn repeat(byte: u8) -> GroupWord {
3737///
3838/// This implementation uses a word-sized integer.
3939#[ derive( Copy , Clone ) ]
40- pub struct Group ( GroupWord ) ;
40+ pub ( crate ) struct Group ( GroupWord ) ;
4141
4242// We perform all operations in the native endianness, and convert to
4343// little-endian just before creating a BitMask. The can potentially
@@ -46,14 +46,14 @@ pub struct Group(GroupWord);
4646#[ allow( clippy:: use_self) ]
4747impl Group {
4848 /// Number of bytes in the group.
49- pub const WIDTH : usize = mem:: size_of :: < Self > ( ) ;
49+ pub ( crate ) const WIDTH : usize = mem:: size_of :: < Self > ( ) ;
5050
5151 /// Returns a full group of empty bytes, suitable for use as the initial
5252 /// value for an empty hash table.
5353 ///
5454 /// This is guaranteed to be aligned to the group size.
5555 #[ inline]
56- pub const fn static_empty ( ) -> & ' static [ u8 ; Group :: WIDTH ] {
56+ pub ( crate ) const fn static_empty ( ) -> & ' static [ u8 ; Group :: WIDTH ] {
5757 #[ repr( C ) ]
5858 struct AlignedBytes {
5959 _align : [ Group ; 0 ] ,
@@ -69,15 +69,15 @@ impl Group {
6969 /// Loads a group of bytes starting at the given address.
7070 #[ inline]
7171 #[ allow( clippy:: cast_ptr_alignment) ] // unaligned load
72- pub unsafe fn load ( ptr : * const u8 ) -> Self {
72+ pub ( crate ) unsafe fn load ( ptr : * const u8 ) -> Self {
7373 Group ( ptr:: read_unaligned ( ptr. cast ( ) ) )
7474 }
7575
7676 /// Loads a group of bytes starting at the given address, which must be
7777 /// aligned to `mem::align_of::<Group>()`.
7878 #[ inline]
7979 #[ allow( clippy:: cast_ptr_alignment) ]
80- pub unsafe fn load_aligned ( ptr : * const u8 ) -> Self {
80+ pub ( crate ) unsafe fn load_aligned ( ptr : * const u8 ) -> Self {
8181 // FIXME: use align_offset once it stabilizes
8282 debug_assert_eq ! ( ptr as usize & ( mem:: align_of:: <Self >( ) - 1 ) , 0 ) ;
8383 Group ( ptr:: read ( ptr. cast ( ) ) )
@@ -87,7 +87,7 @@ impl Group {
8787 /// aligned to `mem::align_of::<Group>()`.
8888 #[ inline]
8989 #[ allow( clippy:: cast_ptr_alignment) ]
90- pub unsafe fn store_aligned ( self , ptr : * mut u8 ) {
90+ pub ( crate ) unsafe fn store_aligned ( self , ptr : * mut u8 ) {
9191 // FIXME: use align_offset once it stabilizes
9292 debug_assert_eq ! ( ptr as usize & ( mem:: align_of:: <Self >( ) - 1 ) , 0 ) ;
9393 ptr:: write ( ptr. cast ( ) , self . 0 ) ;
@@ -104,7 +104,7 @@ impl Group {
104104 /// - This only happens if there is at least 1 true match.
105105 /// - The chance of this happening is very low (< 1% chance per byte).
106106 #[ inline]
107- pub fn match_byte ( self , byte : u8 ) -> BitMask {
107+ pub ( crate ) fn match_byte ( self , byte : u8 ) -> BitMask {
108108 // This algorithm is derived from
109109 // https://graphics.stanford.edu/~seander/bithacks.html##ValueInWord
110110 let cmp = self . 0 ^ repeat ( byte) ;
@@ -114,7 +114,7 @@ impl Group {
114114 /// Returns a `BitMask` indicating all bytes in the group which are
115115 /// `EMPTY`.
116116 #[ inline]
117- pub fn match_empty ( self ) -> BitMask {
117+ pub ( crate ) fn match_empty ( self ) -> BitMask {
118118 // If the high bit is set, then the byte must be either:
119119 // 1111_1111 (EMPTY) or 1000_0000 (DELETED).
120120 // So we can just check if the top two bits are 1 by ANDing them.
@@ -124,14 +124,14 @@ impl Group {
124124 /// Returns a `BitMask` indicating all bytes in the group which are
125125 /// `EMPTY` or `DELETED`.
126126 #[ inline]
127- pub fn match_empty_or_deleted ( self ) -> BitMask {
127+ pub ( crate ) fn match_empty_or_deleted ( self ) -> BitMask {
128128 // A byte is EMPTY or DELETED iff the high bit is set
129129 BitMask ( ( self . 0 & repeat ( 0x80 ) ) . to_le ( ) )
130130 }
131131
132132 /// Returns a `BitMask` indicating all bytes in the group which are full.
133133 #[ inline]
134- pub fn match_full ( self ) -> BitMask {
134+ pub ( crate ) fn match_full ( self ) -> BitMask {
135135 self . match_empty_or_deleted ( ) . invert ( )
136136 }
137137
@@ -140,7 +140,7 @@ impl Group {
140140 /// - `DELETED => EMPTY`
141141 /// - `FULL => DELETED`
142142 #[ inline]
143- pub fn convert_special_to_empty_and_full_to_deleted ( self ) -> Self {
143+ pub ( crate ) fn convert_special_to_empty_and_full_to_deleted ( self ) -> Self {
144144 // Map high_bit = 1 (EMPTY or DELETED) to 1111_1111
145145 // and high_bit = 0 (FULL) to 1000_0000
146146 //
0 commit comments