This commit is contained in:
Jeremy Soller
2024-02-15 23:03:38 +00:00
parent 667ffcc01a
commit c07e46b7ba
13 changed files with 717 additions and 400 deletions
+9 -5
View File
@@ -1,7 +1,7 @@
use core::{marker::PhantomData, mem, ops, slice};
use simple_endian::*;
use crate::{BlockPtr, BlockRaw};
use crate::{BlockLevel, BlockPtr, BlockRaw, BlockTrait};
// 1 << 8 = 256, this is the number of entries in a TreeList
const TREE_LIST_SHIFT: u32 = 8;
@@ -50,10 +50,14 @@ pub struct TreeList<T> {
pub ptrs: [BlockPtr<T>; TREE_LIST_ENTRIES],
}
impl<T> Default for TreeList<T> {
fn default() -> Self {
Self {
ptrs: [BlockPtr::default(); TREE_LIST_ENTRIES],
unsafe impl<T> BlockTrait for TreeList<T> {
fn empty(level: BlockLevel) -> Option<Self> {
if level.0 == 0 {
Some(Self {
ptrs: [BlockPtr::default(); TREE_LIST_ENTRIES],
})
} else {
None
}
}
}