Skip to content

Commit

Permalink
chore: make memory-limit private (#796)
Browse files Browse the repository at this point in the history
* chore: make memory-limit private

* Update crates/interpreter/src/interpreter/shared_memory.rs
  • Loading branch information
mattsse committed Oct 12, 2023
1 parent 7fd723d commit 842e26e
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions crates/interpreter/src/interpreter/shared_memory.rs
Expand Up @@ -22,24 +22,7 @@ pub struct SharedMemory {
current_len: usize,
/// Memory limit. See [`crate::CfgEnv`].
#[cfg(feature = "memory_limit")]
pub memory_limit: u64,
}

impl fmt::Debug for SharedMemory {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SharedMemory")
.field(
"current_slice",
&crate::primitives::hex::encode(self.context_memory()),
)
.finish()
}
}

impl Default for SharedMemory {
fn default() -> Self {
Self::new()
}
memory_limit: u64,
}

impl SharedMemory {
Expand Down Expand Up @@ -250,6 +233,24 @@ impl SharedMemory {
}
}

impl fmt::Debug for SharedMemory {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SharedMemory")
.field("current_len", &self.current_len)
.field(
"context_memory",
&crate::primitives::hex::encode(self.context_memory()),
)
.finish_non_exhaustive()
}
}

impl Default for SharedMemory {
fn default() -> Self {
Self::new()
}
}

/// Rounds up `x` to the closest multiple of 32. If `x % 32 == 0` then `x` is returned.
#[inline]
pub fn next_multiple_of_32(x: usize) -> Option<usize> {
Expand Down

0 comments on commit 842e26e

Please sign in to comment.