From fb5779a00eeeef78228ec61e09331fbed503293a Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Thu, 25 Feb 2016 16:55:03 +0300 Subject: [PATCH] specific feature for asm opt --- util/Cargo.toml | 1 + util/src/lib.rs | 2 +- util/src/uint.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/util/Cargo.toml b/util/Cargo.toml index 6d2ebcd9b..e2e91eb4b 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -39,6 +39,7 @@ target_info = "0.1" [features] default = [] dev = ["clippy"] +x64asm = [] [build-dependencies] vergen = "*" diff --git a/util/src/lib.rs b/util/src/lib.rs index 1f04240dc..d0c74af10 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -16,7 +16,7 @@ #![warn(missing_docs)] #![cfg_attr(feature="dev", feature(plugin))] -#![cfg_attr(feature="dev", feature(asm))] +#![cfg_attr(feature="x64asm", feature(asm))] #![cfg_attr(feature="dev", plugin(clippy))] // Clippy settings diff --git a/util/src/uint.rs b/util/src/uint.rs index 6869c3ec1..98c16ab90 100644 --- a/util/src/uint.rs +++ b/util/src/uint.rs @@ -51,7 +51,7 @@ macro_rules! impl_map_from { } } -#[cfg(not(all(feature="dev", target_arch = "x86_64")))] +#[cfg(not(all(feature="x64asm", target_arch = "x86_64")))] macro_rules! uint_overflowing_add { ($name:ident, $n_words:expr, $self_expr: expr, $other: expr) => ({ uint_overflowing_add_reg!($name, $n_words, $self_expr, $other) @@ -89,7 +89,7 @@ macro_rules! uint_overflowing_add_reg { } -#[cfg(all(feature="dev", target_arch = "x86_64"))] +#[cfg(all(feature="x64asm", target_arch = "x86_64"))] macro_rules! uint_overflowing_add { (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ let mut result: [u64; 4] = unsafe { mem::uninitialized() }; @@ -119,7 +119,7 @@ macro_rules! uint_overflowing_add { ) } -#[cfg(not(all(feature="dev", target_arch = "x86_64")))] +#[cfg(not(all(feature="x64asm", target_arch = "x86_64")))] macro_rules! uint_overflowing_sub { ($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({ let res = overflowing!((!$other).overflowing_add(From::from(1u64))); @@ -128,7 +128,7 @@ macro_rules! uint_overflowing_sub { }) } -#[cfg(all(feature="dev", target_arch = "x86_64"))] +#[cfg(all(feature="x64asm", target_arch = "x86_64"))] macro_rules! uint_overflowing_sub { (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ let mut result: [u64; 4] = unsafe { mem::uninitialized() }; @@ -158,7 +158,7 @@ macro_rules! uint_overflowing_sub { }) } -#[cfg(all(feature="dev", target_arch = "x86_64"))] +#[cfg(all(feature="x64asm", target_arch = "x86_64"))] macro_rules! uint_overflowing_mul { (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ let mut result: [u64; 4] = unsafe { mem::uninitialized() }; @@ -283,7 +283,7 @@ macro_rules! uint_overflowing_mul { ) } -#[cfg(not(all(feature="dev", target_arch = "x86_64")))] +#[cfg(not(all(feature="x64asm", target_arch = "x86_64")))] macro_rules! uint_overflowing_mul { ($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({ uint_overflowing_mul_reg!($name, $n_words, $self_expr, $other)