Skip to content

Commit

Permalink
· Refactoring & Cleanup (unused code)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosga committed Mar 6, 2024
1 parent 51ff894 commit a35b6a7
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 356 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ overflow-checks = false # Disable integer overflow checks.
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
serde = ["serde/default", "serde_json/default"]
sqlx_postgres = ["sqlx/default", "sqlx/postgres", "byteorder/default", "async-std/default"]
sqlx-postgres = ["sqlx/default", "sqlx/postgres", "byteorder/default", "async-std/default"]

[dependencies]
forward_ref = { version = "1.0.0" }
Expand Down
1 change: 0 additions & 1 deletion src/bid128_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/* -------------------------------------------------------------------------------------------------- */

#![allow(unused_assignments)]
#![allow(dead_code)]

#[cfg(target_endian = "big")]
use crate::bid_conf::BID_SWAP128;
Expand Down
1 change: 0 additions & 1 deletion src/bid128_fma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/* -------------------------------------------------------------------------------------------------- */

#![allow(unused_assignments)]
#![allow(dead_code)]

#[cfg(target_endian = "big")]
use crate::bid_conf::BID_SWAP128;
Expand Down
2 changes: 0 additions & 2 deletions src/bid128_mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
/* Intel® Decimal Floating-Point Math Library - Copyright (c) 2018, Intel Corp. */
/* -------------------------------------------------------------------------------------------------- */

#![allow(dead_code)]

#[cfg(target_endian = "big")]
use crate::bid_conf::BID_SWAP128;

Expand Down
2 changes: 2 additions & 0 deletions src/bid_decimal_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use crate::bid_internal::{BID_UINT64, BID_UINT128};

/*
pub (crate) const BID_ROUND_CONST_TABLE: [[u64; 19]; 5] = [
[ // RN
0u64, // 0 extra digits
Expand Down Expand Up @@ -116,6 +117,7 @@ pub (crate) const BID_ROUND_CONST_TABLE: [[u64; 19]; 5] = [
500000000000000000u64 // 18 extra digits
]
];
*/

pub (crate) const BID_ROUND_CONST_TABLE_128: [[BID_UINT128; 36]; 5] = [
[ //RN
Expand Down
419 changes: 72 additions & 347 deletions src/bid_internal.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/d128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub const INFINITY: d128 = d128 { w: [0x0000000000000000u64, 0x7800000000000000u
pub const NEGATIVE_INFINITY: d128 = d128 { w: [0x0000000000000000u64, 0xF800000000000000u64] };

/// The number of digits in the coefficient.
pub const MANTISSA_DIGITS: u32 = 34;
pub const MANTISSA_DIGITS: u32 = BID128_MAXDIGITS;

/// The difference between 1 and the least value greater than 1 that is representable in the given floating point type (1E-33).
pub const EPSILON: d128 = d128 { w: [0x1u64, 0x2FFE000000000000u64] };
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ pub mod d128;
#[cfg(feature = "serde")]
pub mod serde;

#[cfg(feature = "sqlx_postgres")]
#[cfg(feature = "sqlx-postgres")]
pub mod sqlx_postgres;
2 changes: 1 addition & 1 deletion src/sqlx_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use sqlx::Decode;
use sqlx::encode::Encode;
use sqlx::postgres::PgValueFormat;

use crate::bid_internal::{ BID_UINT128, BID_UINT64, unpack_BID128};
use crate::bid_internal::{BID_UINT128, BID_UINT64, unpack_BID128};
use crate::d128::{d128, INFINITY, NAN, NEGATIVE_INFINITY};

// https://doxygen.postgresql.org/backend_2utils_2adt_2numeric_8c_source.html
Expand Down
2 changes: 1 addition & 1 deletion tests/sqlx_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#[macro_export]
macro_rules! sqlx_test {
($name:ident, sqlx_decimal, $precision:expr, $scale:expr, $input1:expr) => {
#[cfg(feature = "sqlx_postgres")]
#[cfg(feature = "sqlx-postgres")]
#[sqlx::test]
#[allow(dead_code)]
async fn $name() -> sqlx::Result<()> {
Expand Down

0 comments on commit a35b6a7

Please sign in to comment.