From 71128cd2dca651722a9c514d01c188d4297a2c08 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Thu, 8 Feb 2018 23:59:37 +0300 Subject: [PATCH] Use memory_units from git. --- Cargo.toml | 2 +- src/memory.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a30a643..aa850d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ exclude = [ "res/*", "spec/*" ] [dependencies] parity-wasm = "0.23" byteorder = "1.0" -memory_units = "0.2" +memory_units = { git = "https://github.com/pepyakin/memory_units.git", rev = "e09093e" } [dev-dependencies] wabt = "0.1.2" diff --git a/src/memory.rs b/src/memory.rs index 3c31cc6..1071e55 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -6,14 +6,14 @@ use std::rc::Rc; use std::cell::RefCell; use parity_wasm::elements::ResizableLimits; use Error; -use memory_units::{RoundUpTo, Pages, Bytes, ByteSize}; +use memory_units::{RoundUpTo, Pages, Bytes}; /// 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: Bytes = Pages::BYTE_SIZE; +pub const LINEAR_MEMORY_PAGE_SIZE: Bytes = Bytes(65536); /// Maximal number of pages. const LINEAR_MEMORY_MAX_PAGES: Pages = Pages(65536); @@ -366,7 +366,7 @@ mod tests { use super::{MemoryInstance, LINEAR_MEMORY_PAGE_SIZE}; use Error; - use memory_units::{Pages, Bytes}; + use memory_units::Pages; #[test] fn alloc() { @@ -401,7 +401,8 @@ mod tests { #[test] 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 {