Skip to content

Commit

Permalink
Add check that heap size is a multiple of 8
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Oct 6, 2023
1 parent e5ba199 commit f71a842
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ impl MemBlock
/// Resize to a new size in bytes
pub fn resize(&mut self, num_bytes: usize)
{
// The heap size should be a multiple of 8
if num_bytes % 8 != 0 {
panic!("the heap size should be a multiple of 8 bytes")
}

self.data.resize(num_bytes, 0);
}

Expand Down

0 comments on commit f71a842

Please sign in to comment.