move use/const statements to a limited scope

This commit is contained in:
Lokathor 2019-08-07 14:16:10 -06:00
parent 47d6a214d4
commit 887fca89c2
2 changed files with 6 additions and 5 deletions

View file

@ -77,9 +77,6 @@
*/
use core::f64;
use core::num::Wrapping;
const TINY: f64 = 1.0e-300;
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn sqrt(x: f64) -> f64 {
@ -112,6 +109,10 @@ pub fn sqrt(x: f64) -> f64 {
}
#[cfg(not(target_feature = "sse2"))]
{
use core::num::Wrapping;
const TINY: f64 = 1.0e-300;
let mut z: f64;
let sign: Wrapping<u32> = Wrapping(0x80000000);
let mut ix0: i32;

View file

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