Skip to content

Commit

Permalink
hierarchy: fix data structure size tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Sep 24, 2024
1 parent 73d2294 commit 2cb866d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = ["wellen"]
default-members = ["wellen"]

[workspace.package]
version = "0.11.0"
version = "0.11.1"
edition = "2021"
# we require the `div_ceil` method on integers
rust-version = "1.73.0"
Expand Down
9 changes: 4 additions & 5 deletions wellen/src/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,7 @@ mod tests {
+ std::mem::size_of::<Option<EnumTypeId>>() // enum type
+ std::mem::size_of::<HierarchyStringId>() // VHDL type name
+ std::mem::size_of::<Option<ScopeRef>>() // parent
+ std::mem::size_of::<HierarchyItemId>() // next
+ 2 // padding
+ std::mem::size_of::<HierarchyItemId>() // next
);
// currently this all comes out to 48 bytes (~= 6x 64-bit pointers)
assert_eq!(std::mem::size_of::<Var>(), 48);
Expand All @@ -1236,10 +1235,10 @@ mod tests {
+ std::mem::size_of::<HierarchyItemId>() // child
+ std::mem::size_of::<ScopeRef>() // parent
+ std::mem::size_of::<HierarchyItemId>() // next
+ 1 // padding
+ 3 // padding
);
// currently this all comes out to 32 bytes (~= 4x 64-bit pointers)
assert_eq!(std::mem::size_of::<Scope>(), 32);
// currently this all comes out to 32 bytes (~= 4.5x 64-bit pointers)
assert_eq!(std::mem::size_of::<Scope>(), 36);

// for comparison: one string is 24 bytes for the struct alone (ignoring heap allocation)
assert_eq!(std::mem::size_of::<String>(), 24);
Expand Down

0 comments on commit 2cb866d

Please sign in to comment.