Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

changing x64 asm config #534

Merged
merged 3 commits into from
Feb 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ target_info = "0.1"
[features]
default = []
dev = ["clippy"]
x64asm = []

[build-dependencies]
vergen = "*"
rustc_version = "0.1"
9 changes: 8 additions & 1 deletion util/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
extern crate vergen;
extern crate rustc_version;

use vergen::*;
use rustc_version::{version_meta, Channel};

fn main() {
vergen(OutputFns::all()).unwrap();
}

if let Channel::Nightly = version_meta().channel {
println!("cargo:rustc-cfg=x64asm");
}
}
2 changes: 1 addition & 1 deletion util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#![warn(missing_docs)]
#![cfg_attr(feature="dev", feature(plugin))]
#![cfg_attr(feature="x64asm", feature(asm))]
#![cfg_attr(x64asm, feature(asm))]
#![cfg_attr(feature="dev", plugin(clippy))]

// Clippy settings
Expand Down
12 changes: 6 additions & 6 deletions util/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ macro_rules! impl_map_from {
}
}

#[cfg(not(all(feature="x64asm", target_arch="x86_64")))]
#[cfg(not(all(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)
Expand Down Expand Up @@ -89,7 +89,7 @@ macro_rules! uint_overflowing_add_reg {
}


#[cfg(all(feature="x64asm", target_arch="x86_64"))]
#[cfg(all(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() };
Expand Down Expand Up @@ -165,7 +165,7 @@ macro_rules! uint_overflowing_add {
)
}

#[cfg(not(all(feature="x64asm", target_arch="x86_64")))]
#[cfg(not(all(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)));
Expand All @@ -174,7 +174,7 @@ macro_rules! uint_overflowing_sub {
})
}

#[cfg(all(feature="x64asm", target_arch="x86_64"))]
#[cfg(all(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() };
Expand Down Expand Up @@ -250,7 +250,7 @@ macro_rules! uint_overflowing_sub {
})
}

#[cfg(all(feature="x64asm", target_arch="x86_64"))]
#[cfg(all(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() };
Expand Down Expand Up @@ -370,7 +370,7 @@ macro_rules! uint_overflowing_mul {
)
}

#[cfg(not(all(feature="x64asm", target_arch="x86_64")))]
#[cfg(not(all(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)
Expand Down