From 9260d443623add83f14477c7210aa8dbeb2a8b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Sun, 12 Jun 2016 10:30:44 +0200 Subject: [PATCH] Fixing uint ASM macros --- util/bigint/src/uint.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/util/bigint/src/uint.rs b/util/bigint/src/uint.rs index 5c8da4a3c..286f6a43f 100644 --- a/util/bigint/src/uint.rs +++ b/util/bigint/src/uint.rs @@ -91,9 +91,9 @@ macro_rules! uint_overflowing_add_reg { #[cfg(all(asm_available, 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() }; - let self_t: &[u64; 4] = &self.0; - let other_t: &[u64; 4] = &other.0; + let mut result: [u64; $n_words] = unsafe { mem::uninitialized() }; + let self_t: &[u64; $n_words] = &$self_expr.0; + let other_t: &[u64; $n_words] = &$other.0; let overflow: u8; unsafe { @@ -114,9 +114,9 @@ macro_rules! uint_overflowing_add { (U256(result), overflow != 0) }); (U512, $n_words: expr, $self_expr: expr, $other: expr) => ({ - let mut result: [u64; 8] = unsafe { mem::uninitialized() }; - let self_t: &[u64; 8] = &self.0; - let other_t: &[u64; 8] = &other.0; + let mut result: [u64; $n_words] = unsafe { mem::uninitialized() }; + let self_t: &[u64; $n_words] = &$self_expr.0; + let other_t: &[u64; $n_words] = &$other.0; let overflow: u8; @@ -195,9 +195,9 @@ macro_rules! uint_overflowing_sub_reg { #[cfg(all(asm_available, 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() }; - let self_t: &[u64; 4] = &self.0; - let other_t: &[u64; 4] = &other.0; + let mut result: [u64; $n_words] = unsafe { mem::uninitialized() }; + let self_t: &[u64; $n_words] = &$self_expr.0; + let other_t: &[u64; $n_words] = &$other.0; let overflow: u8; unsafe { @@ -217,9 +217,9 @@ macro_rules! uint_overflowing_sub { (U256(result), overflow != 0) }); (U512, $n_words: expr, $self_expr: expr, $other: expr) => ({ - let mut result: [u64; 8] = unsafe { mem::uninitialized() }; - let self_t: &[u64; 8] = &self.0; - let other_t: &[u64; 8] = &other.0; + let mut result: [u64; $n_words] = unsafe { mem::uninitialized() }; + let self_t: &[u64; $n_words] = &$self_expr.0; + let other_t: &[u64; $n_words] = &$other.0; let overflow: u8; @@ -269,9 +269,9 @@ macro_rules! uint_overflowing_sub { #[cfg(all(asm_available, 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() }; - let self_t: &[u64; 4] = &self.0; - let other_t: &[u64; 4] = &self.0; + let mut result: [u64; $n_words] = unsafe { mem::uninitialized() }; + let self_t: &[u64; $n_words] = &$self_expr.0; + let other_t: &[u64; $n_words] = &$other.0; let overflow: u64; unsafe {