Use memory_units from git.
This commit is contained in:
parent
1fb0821bdc
commit
71128cd2dc
|
@ -11,7 +11,7 @@ exclude = [ "res/*", "spec/*" ]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-wasm = "0.23"
|
parity-wasm = "0.23"
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
memory_units = "0.2"
|
memory_units = { git = "https://github.com/pepyakin/memory_units.git", rev = "e09093e" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wabt = "0.1.2"
|
wabt = "0.1.2"
|
||||||
|
|
|
@ -6,14 +6,14 @@ use std::rc::Rc;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use parity_wasm::elements::ResizableLimits;
|
use parity_wasm::elements::ResizableLimits;
|
||||||
use Error;
|
use Error;
|
||||||
use memory_units::{RoundUpTo, Pages, Bytes, ByteSize};
|
use memory_units::{RoundUpTo, Pages, Bytes};
|
||||||
|
|
||||||
/// Size of a page of [linear memory][`MemoryInstance`] - 64KiB.
|
/// Size of a page of [linear memory][`MemoryInstance`] - 64KiB.
|
||||||
///
|
///
|
||||||
/// The size of a memory is always a integer multiple of a page size.
|
/// The size of a memory is always a integer multiple of a page size.
|
||||||
///
|
///
|
||||||
/// [`MemoryInstance`]: struct.MemoryInstance.html
|
/// [`MemoryInstance`]: struct.MemoryInstance.html
|
||||||
pub const LINEAR_MEMORY_PAGE_SIZE: Bytes = Pages::BYTE_SIZE;
|
pub const LINEAR_MEMORY_PAGE_SIZE: Bytes = Bytes(65536);
|
||||||
|
|
||||||
/// Maximal number of pages.
|
/// Maximal number of pages.
|
||||||
const LINEAR_MEMORY_MAX_PAGES: Pages = Pages(65536);
|
const LINEAR_MEMORY_MAX_PAGES: Pages = Pages(65536);
|
||||||
|
@ -366,7 +366,7 @@ mod tests {
|
||||||
|
|
||||||
use super::{MemoryInstance, LINEAR_MEMORY_PAGE_SIZE};
|
use super::{MemoryInstance, LINEAR_MEMORY_PAGE_SIZE};
|
||||||
use Error;
|
use Error;
|
||||||
use memory_units::{Pages, Bytes};
|
use memory_units::Pages;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn alloc() {
|
fn alloc() {
|
||||||
|
@ -401,7 +401,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_page_size() {
|
fn ensure_page_size() {
|
||||||
assert_eq!(LINEAR_MEMORY_PAGE_SIZE, Bytes(65536));
|
use memory_units::ByteSize;
|
||||||
|
assert_eq!(LINEAR_MEMORY_PAGE_SIZE, Pages::byte_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_memory(initial_content: &[u8]) -> MemoryInstance {
|
fn create_memory(initial_content: &[u8]) -> MemoryInstance {
|
||||||
|
|
Loading…
Reference in New Issue