Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit a9fa14d

Browse files
committed
move use/const statements to a limited scope
1 parent 519c5d6 commit a9fa14d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/math/sqrt.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777
*/
7878

7979
use core::f64;
80-
use core::num::Wrapping;
81-
82-
const TINY: f64 = 1.0e-300;
8380

8481
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
8582
pub fn sqrt(x: f64) -> f64 {
@@ -112,6 +109,10 @@ pub fn sqrt(x: f64) -> f64 {
112109
}
113110
#[cfg(not(target_feature = "sse2"))]
114111
{
112+
use core::num::Wrapping;
113+
114+
const TINY: f64 = 1.0e-300;
115+
115116
let mut z: f64;
116117
let sign: Wrapping<u32> = Wrapping(0x80000000);
117118
let mut ix0: i32;

src/math/sqrtf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
* ====================================================
1414
*/
1515

16-
const TINY: f32 = 1.0e-30;
17-
1816
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
1917
pub fn sqrtf(x: f32) -> f32 {
2018
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
@@ -46,6 +44,8 @@ pub fn sqrtf(x: f32) -> f32 {
4644
}
4745
#[cfg(not(target_feature = "sse"))]
4846
{
47+
const TINY: f32 = 1.0e-30;
48+
4949
let mut z: f32;
5050
let sign: i32 = 0x80000000u32 as i32;
5151
let mut ix: i32;

0 commit comments

Comments
 (0)