specific feature for asm opt

This commit is contained in:
Nikolay Volf 2016-02-25 16:55:03 +03:00
parent 5467b06c4f
commit fb5779a00e
3 changed files with 8 additions and 7 deletions

View File

@ -39,6 +39,7 @@ target_info = "0.1"
[features] [features]
default = [] default = []
dev = ["clippy"] dev = ["clippy"]
x64asm = []
[build-dependencies] [build-dependencies]
vergen = "*" vergen = "*"

View File

@ -16,7 +16,7 @@
#![warn(missing_docs)] #![warn(missing_docs)]
#![cfg_attr(feature="dev", feature(plugin))] #![cfg_attr(feature="dev", feature(plugin))]
#![cfg_attr(feature="dev", feature(asm))] #![cfg_attr(feature="x64asm", feature(asm))]
#![cfg_attr(feature="dev", plugin(clippy))] #![cfg_attr(feature="dev", plugin(clippy))]
// Clippy settings // Clippy settings

View File

@ -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 { macro_rules! uint_overflowing_add {
($name:ident, $n_words:expr, $self_expr: expr, $other: expr) => ({ ($name:ident, $n_words:expr, $self_expr: expr, $other: expr) => ({
uint_overflowing_add_reg!($name, $n_words, $self_expr, $other) 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 { macro_rules! uint_overflowing_add {
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
let mut result: [u64; 4] = unsafe { mem::uninitialized() }; 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 { macro_rules! uint_overflowing_sub {
($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({ ($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({
let res = overflowing!((!$other).overflowing_add(From::from(1u64))); 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 { macro_rules! uint_overflowing_sub {
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
let mut result: [u64; 4] = unsafe { mem::uninitialized() }; 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 { macro_rules! uint_overflowing_mul {
(U256, $n_words: expr, $self_expr: expr, $other: expr) => ({ (U256, $n_words: expr, $self_expr: expr, $other: expr) => ({
let mut result: [u64; 4] = unsafe { mem::uninitialized() }; 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 { macro_rules! uint_overflowing_mul {
($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({ ($name:ident, $n_words: expr, $self_expr: expr, $other: expr) => ({
uint_overflowing_mul_reg!($name, $n_words, $self_expr, $other) uint_overflowing_mul_reg!($name, $n_words, $self_expr, $other)