Merge pull request #165 from mingnus/main

Fix the max_entries in node_header
This commit is contained in:
Joe Thornber 2021-03-11 10:54:44 +00:00 committed by GitHub
commit 1b7f43ef9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,8 @@ pub fn pack_node<W: WriteBytesExt, V: Pack + Unpack>(node: &Node<V>, w: &mut W)
pub fn calc_max_entries<V: Unpack>() -> usize {
let elt_size = 8 + V::disk_size() as usize;
((BLOCK_SIZE - NodeHeader::disk_size() as usize) / elt_size) as usize
let total = ((BLOCK_SIZE - NodeHeader::disk_size() as usize) / elt_size) as usize
total / 3 * 3
}
//------------------------------------------