get compiling for wasm
This commit is contained in:
parent
ca6a5a2479
commit
853bb53158
|
@ -12,15 +12,15 @@ repository = "https://github.com/debris/ethbloom"
|
|||
tiny-keccak = "1.4"
|
||||
crunchy = { version = "0.1.6", features = ["limit_256"] }
|
||||
fixed-hash = { version = "0.1.3", path = "../fixed-hash" }
|
||||
ethereum-types-serialize = { version = "0.2", path = "../serialize", optional = true }
|
||||
ethereum-types-serialize = { version = "0.2.1", path = "../serialize", optional = true }
|
||||
serde = { version = "1.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.4"
|
||||
rand = { version = "0.4" }
|
||||
rustc-hex = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["std", "heapsizeof", "serialize"]
|
||||
default = ["std", "heapsizeof", "serialize", "fixed-hash/libc"]
|
||||
std = ["fixed-hash/std"]
|
||||
heapsizeof = ["fixed-hash/heapsizeof"]
|
||||
serialize = ["std", "ethereum-types-serialize", "serde"]
|
||||
|
|
|
@ -8,10 +8,11 @@ description = "Fixed-size hashes"
|
|||
|
||||
[dependencies]
|
||||
heapsize = { version = "0.4", optional = true }
|
||||
libc = { version = "0.2", default-features = false }
|
||||
libc = { version = "0.2", optional = true, default-features = false }
|
||||
rand = { version = "0.4", optional = true }
|
||||
rustc-hex = { version = "1.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["libc"]
|
||||
std = ["rustc-hex", "rand"]
|
||||
heapsizeof = ["heapsize"]
|
||||
|
|
|
@ -157,21 +157,6 @@ macro_rules! construct_hash {
|
|||
|
||||
impl Eq for $from {}
|
||||
|
||||
impl PartialEq for $from {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
unsafe { $crate::libc::memcmp(self.0.as_ptr() as *const $crate::libc::c_void, other.0.as_ptr() as *const $crate::libc::c_void, $size) == 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for $from {
|
||||
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
|
||||
let r = unsafe { $crate::libc::memcmp(self.0.as_ptr() as *const $crate::libc::c_void, other.0.as_ptr() as *const $crate::libc::c_void, $size) };
|
||||
if r < 0 { return ::core::cmp::Ordering::Less }
|
||||
if r > 0 { return ::core::cmp::Ordering::Greater }
|
||||
return ::core::cmp::Ordering::Equal;
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for $from {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
|
@ -313,6 +298,7 @@ macro_rules! construct_hash {
|
|||
|
||||
impl_std_for_hash!($from, $size);
|
||||
impl_heapsize_for_hash!($from);
|
||||
impl_libc_for_hash!($from, $size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,3 +407,57 @@ macro_rules! impl_std_for_hash_internals {
|
|||
macro_rules! impl_std_for_hash_internals {
|
||||
($from: ident, $size: tt) => {}
|
||||
}
|
||||
|
||||
#[cfg(feature="libc")]
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! impl_heapsize_for_hash {
|
||||
($name: ident) => {
|
||||
impl $crate::heapsize::HeapSizeOf for $name {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature="libc")]
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! impl_libc_for_hash {
|
||||
($from: ident, $size: expr) => {
|
||||
impl PartialEq for $from {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
unsafe { $crate::libc::memcmp(self.0.as_ptr() as *const $crate::libc::c_void, other.0.as_ptr() as *const $crate::libc::c_void, $size) == 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for $from {
|
||||
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
|
||||
let r = unsafe { $crate::libc::memcmp(self.0.as_ptr() as *const $crate::libc::c_void, other.0.as_ptr() as *const $crate::libc::c_void, $size) };
|
||||
if r < 0 { return ::core::cmp::Ordering::Less }
|
||||
if r > 0 { return ::core::cmp::Ordering::Greater }
|
||||
return ::core::cmp::Ordering::Equal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature="libc"))]
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! impl_libc_for_hash {
|
||||
($from: ident, $size: expr) => {
|
||||
impl PartialEq for $from {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
&self.0[..] == &other.0[..]
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for $from {
|
||||
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
|
||||
self.0[..].cmp(&other.0[..])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[cfg(feature="libc")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate libc;
|
||||
|
||||
#[cfg(not(feature="libc"))]
|
||||
#[doc(hidden)]
|
||||
pub mod libc { }
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
#[doc(hidden)]
|
||||
pub extern crate heapsize;
|
||||
|
|
|
@ -8,7 +8,7 @@ rustc_version = "0.2"
|
|||
|
||||
[dependencies]
|
||||
crunchy = "0.1.5"
|
||||
ethereum-types = { path ="../ethereum-types", features = ["std", "heapsizeof"] }
|
||||
ethereum-types = { version = "0.2.3", path ="../ethereum-types", features = ["std", "heapsizeof"] }
|
||||
quickcheck = "0.6"
|
||||
serde_json = "1.0"
|
||||
uint = { path = "../uint" }
|
||||
|
|
Loading…
Reference in New Issue