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"
|
tiny-keccak = "1.4"
|
||||||
crunchy = { version = "0.1.6", features = ["limit_256"] }
|
crunchy = { version = "0.1.6", features = ["limit_256"] }
|
||||||
fixed-hash = { version = "0.1.3", path = "../fixed-hash" }
|
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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.4"
|
rand = { version = "0.4" }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "heapsizeof", "serialize"]
|
default = ["std", "heapsizeof", "serialize", "fixed-hash/libc"]
|
||||||
std = ["fixed-hash/std"]
|
std = ["fixed-hash/std"]
|
||||||
heapsizeof = ["fixed-hash/heapsizeof"]
|
heapsizeof = ["fixed-hash/heapsizeof"]
|
||||||
serialize = ["std", "ethereum-types-serialize", "serde"]
|
serialize = ["std", "ethereum-types-serialize", "serde"]
|
||||||
|
|
|
@ -8,10 +8,11 @@ description = "Fixed-size hashes"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
heapsize = { version = "0.4", optional = true }
|
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 }
|
rand = { version = "0.4", optional = true }
|
||||||
rustc-hex = { version = "1.0", optional = true }
|
rustc-hex = { version = "1.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["libc"]
|
||||||
std = ["rustc-hex", "rand"]
|
std = ["rustc-hex", "rand"]
|
||||||
heapsizeof = ["heapsize"]
|
heapsizeof = ["heapsize"]
|
||||||
|
|
|
@ -157,21 +157,6 @@ macro_rules! construct_hash {
|
||||||
|
|
||||||
impl Eq for $from {}
|
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 {
|
impl PartialOrd for $from {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> {
|
||||||
Some(self.cmp(other))
|
Some(self.cmp(other))
|
||||||
|
@ -313,6 +298,7 @@ macro_rules! construct_hash {
|
||||||
|
|
||||||
impl_std_for_hash!($from, $size);
|
impl_std_for_hash!($from, $size);
|
||||||
impl_heapsize_for_hash!($from);
|
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 {
|
macro_rules! impl_std_for_hash_internals {
|
||||||
($from: ident, $size: tt) => {}
|
($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
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
#[cfg(feature="libc")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub extern crate libc;
|
pub extern crate libc;
|
||||||
|
|
||||||
|
#[cfg(not(feature="libc"))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub mod libc { }
|
||||||
|
|
||||||
#[cfg(feature="heapsizeof")]
|
#[cfg(feature="heapsizeof")]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub extern crate heapsize;
|
pub extern crate heapsize;
|
||||||
|
|
|
@ -8,7 +8,7 @@ rustc_version = "0.2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crunchy = "0.1.5"
|
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"
|
quickcheck = "0.6"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
uint = { path = "../uint" }
|
uint = { path = "../uint" }
|
||||||
|
|
Loading…
Reference in New Issue