Skip to content

Commit 1bdafca

Browse files
matthewfollegotPSeitz
authored andcommitted
add doc comments
1 parent c90fc91 commit 1bdafca

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/block/hashtable.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ pub trait HashTable {
5252
const HASHTABLE_SIZE_4K: usize = 4 * 1024;
5353
const HASHTABLE_BIT_SHIFT_4K: usize = 4;
5454

55+
/// A 4K entry hash table using 16-bit values.
5556
#[derive(Debug)]
5657
#[repr(align(64))]
5758
pub struct HashTable4KU16 {
5859
dict: Box<[u16; HASHTABLE_SIZE_4K]>,
5960
}
6061
impl HashTable4KU16 {
62+
/// Creates a new zeroed hash table.
6163
#[inline]
6264
pub fn new() -> Self {
6365
// This generates more efficient assembly in contrast to Box::new(slice), because of an
@@ -89,11 +91,13 @@ impl HashTable for HashTable4KU16 {
8991
}
9092
}
9193

94+
/// A 4K entry hash table using 32-bit values.
9295
#[derive(Debug)]
9396
pub struct HashTable4K {
9497
dict: Box<[u32; HASHTABLE_SIZE_4K]>,
9598
}
9699
impl HashTable4K {
100+
/// Creates a new zeroed hash table.
97101
#[inline]
98102
pub fn new() -> Self {
99103
let dict = alloc::vec![0; HASHTABLE_SIZE_4K]
@@ -103,6 +107,7 @@ impl HashTable4K {
103107
Self { dict }
104108
}
105109

110+
/// Shifts all entries down by `offset`, clamping at zero.
106111
#[cold]
107112
#[allow(dead_code)]
108113
pub fn reposition(&mut self, offset: u32) {

0 commit comments

Comments
 (0)