From 1d87fb09dc6daa670cebf5e94c3c1ceb74ec2a15 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Thu, 1 Feb 2018 14:46:49 +0300 Subject: [PATCH] Publish LINEAR_MEMORY_PAGE_SIZE constant (#31) --- src/lib.rs | 2 +- src/memory.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e76a343..98b04a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -220,7 +220,7 @@ mod types; #[cfg(test)] mod tests; -pub use self::memory::{MemoryInstance, MemoryRef}; +pub use self::memory::{MemoryInstance, MemoryRef, LINEAR_MEMORY_PAGE_SIZE}; pub use self::table::{TableInstance, TableRef}; pub use self::value::RuntimeValue; pub use self::host::{Externals, NopExternals, HostError, RuntimeArgs}; diff --git a/src/memory.rs b/src/memory.rs index 9611a24..e2c6882 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -8,8 +8,13 @@ use parity_wasm::elements::ResizableLimits; use Error; use module::check_limits; -/// Linear memory page size. +/// Size of a page of [linear memory][`MemoryInstance`] - 64KiB. +/// +/// The size of a memory is always a integer multiple of a page size. +/// +/// [`MemoryInstance`]: struct.MemoryInstance.html pub const LINEAR_MEMORY_PAGE_SIZE: u32 = 65536; + /// Maximal number of pages. const LINEAR_MEMORY_MAX_PAGES: u32 = 65536;