Skip to content

Commit

Permalink
Remove static_assertions dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jan 5, 2025
1 parent 4045310 commit 23766f4
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 173 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Reduced the required buffer size for integer and float writers when using `buffer_size` and `buffer_size_const` for decimal numbers.
- Deprecated `NumberFormatBuilder::build` due to a lack of validation.
- Deprecated `Options::set_*` in our write float API since options should be considered immutable.
- Removed `static_assertions` dependency.

## [1.0.5] 2024-12-08

Expand Down
3 changes: 0 additions & 3 deletions lexical-parse-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ path = "../lexical-parse-integer"
default-features = false
features = []

[dependencies]
static_assertions = "1"

[features]
default = ["std"]
# Use the standard library.
Expand Down
14 changes: 6 additions & 8 deletions lexical-parse-float/src/table_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#![doc(hidden)]
#![cfg(not(feature = "compact"))]

use static_assertions::const_assert;

#[cfg(not(feature = "radix"))]
use crate::bigint::Limb;
use crate::limits::{f32_exponent_limit, f64_exponent_limit, f64_mantissa_limit, u64_power_limit};
Expand Down Expand Up @@ -113,8 +111,8 @@ pub const SMALL_INT_POW5: [u64; 28] = [
1490116119384765625,
7450580596923828125,
];
const_assert!(SMALL_INT_POW5.len() > f64_mantissa_limit(5) as usize);
const_assert!(SMALL_INT_POW5.len() == u64_power_limit(5) as usize + 1);
const _: () = assert!(SMALL_INT_POW5.len() > f64_mantissa_limit(5) as usize);
const _: () = assert!(SMALL_INT_POW5.len() == u64_power_limit(5) as usize + 1);

/// Pre-computed, small powers-of-10.
pub const SMALL_INT_POW10: [u64; 20] = [
Expand All @@ -139,20 +137,20 @@ pub const SMALL_INT_POW10: [u64; 20] = [
1000000000000000000,
10000000000000000000,
];
const_assert!(SMALL_INT_POW10.len() > f64_mantissa_limit(10) as usize);
const_assert!(SMALL_INT_POW10.len() == u64_power_limit(10) as usize + 1);
const _: () = assert!(SMALL_INT_POW10.len() > f64_mantissa_limit(10) as usize);
const _: () = assert!(SMALL_INT_POW10.len() == u64_power_limit(10) as usize + 1);

/// Pre-computed, small powers-of-10.
pub const SMALL_F32_POW10: [f32; 16] =
[1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 0., 0., 0., 0., 0.];
const_assert!(SMALL_F32_POW10.len() > f32_exponent_limit(10).1 as usize);
const _: () = assert!(SMALL_F32_POW10.len() > f32_exponent_limit(10).1 as usize);

/// Pre-computed, small powers-of-10.
pub const SMALL_F64_POW10: [f64; 32] = [
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16,
1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 0., 0., 0., 0., 0., 0., 0., 0., 0.,
];
const_assert!(SMALL_F64_POW10.len() > f64_exponent_limit(10).1 as usize);
const _: () = assert!(SMALL_F64_POW10.len() > f64_exponent_limit(10).1 as usize);

/// Pre-computed large power-of-5 for 32-bit limbs.
#[cfg(not(all(target_pointer_width = "64", not(target_arch = "sparc"))))]
Expand Down
Loading

0 comments on commit 23766f4

Please sign in to comment.