Skip to content

Commit 6cacf96

Browse files
authored
Merge pull request #2 from EngosSoftware/refactor-set-status-flags-macro
Refactoring
2 parents 78aad6f + 06fe06d commit 6cacf96

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/bid_internal.rs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(unused_macros)]
2-
31
use crate::bid_decimal_data::*;
42
use crate::bid_functions::*;
53
use crate::{BidUint64, BidUint128, BidUint256, IdecFlags, IdecRound};
@@ -60,7 +58,9 @@ pub(crate) use dec;
6058
//======================================
6159

6260
macro_rules! set_status_flags {
63-
($fpsc:expr, $status:expr) => {{ *$fpsc |= $status }};
61+
($fpsc:expr, $status:expr) => {
62+
*$fpsc |= $status
63+
};
6464
}
6565

6666
pub(crate) use set_status_flags;
@@ -926,6 +926,7 @@ macro_rules! mul_128x128_full {
926926
$ql.w[1] = qm2.w[0];
927927
};
928928
}
929+
pub(crate) use mul_128x128_full;
929930

930931
macro_rules! mul_128x128_low {
931932
($ql:expr, $a:expr, $b:expr) => {
@@ -938,27 +939,6 @@ macro_rules! mul_128x128_low {
938939
}
939940
pub(crate) use mul_128x128_low;
940941

941-
macro_rules! mul_128x128_full {
942-
($qh:expr, $ql:expr, $a:expr, $b:expr) => {
943-
let mut albl: BidUint128 = Default::default();
944-
let mut albh: BidUint128 = Default::default();
945-
let mut ahbl: BidUint128 = Default::default();
946-
let mut ahbh: BidUint128 = Default::default();
947-
let mut qm: BidUint128 = Default::default();
948-
let mut qm2: BidUint128 = Default::default();
949-
mul_64x64_to_128!(albh, ($a).w[0], ($b).w[1]);
950-
mul_64x64_to_128!(ahbl, ($b).w[0], ($a).w[1]);
951-
mul_64x64_to_128!(albl, ($a).w[0], ($b).w[0]);
952-
mul_64x64_to_128!(ahbh, ($a).w[1], ($b).w[1]);
953-
add_128_128!(qm, albh, ahbl);
954-
$ql.w[0] = albl.w[0];
955-
add_128_64!(qm2, qm, albl.w[1]);
956-
add_128_64!($qh, ahbh, qm2.w[1]);
957-
$ql.w[1] = qm2.w[0];
958-
};
959-
}
960-
pub(crate) use mul_128x128_full;
961-
962942
/// Get full 64x64-bit product.
963943
/// Note that this macro is used for `CX < 2^61`, `CY < 2^61`.
964944
macro_rules! mul_64x64_to_128_fast {

0 commit comments

Comments
 (0)