Skip to content

Commit ec9c959

Browse files
committed
Remove core::num::One from Float trait
1 parent fed121f commit ec9c959

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/float/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use core::mem::transmute;
2-
use core::num::One;
32
use core::ops::*;
43

54
pub mod add;
@@ -8,7 +7,7 @@ pub mod add;
87
pub trait Float: Sized {
98
/// A uint of the same with as the float
109
type Int: Sized + Copy + Clone + Sub<Output=Self::Int> +
11-
ShlAssign<Self::Int> + Shl<Self::Int, Output=Self::Int> + One;
10+
ShlAssign<Self::Int> + Shl<Self::Int, Output=Self::Int>;
1211

1312
/// Returns the bitwidth of the float type
1413
fn bits() -> u32;
@@ -42,8 +41,8 @@ impl Float for f32 {
4241
}
4342
fn normalize(significand: Self::Int) -> (Self::Int, Self::Int) {
4443
let shift = Self::Int::leading_zeros(significand)
45-
- Self::Int::leading_zeros(Self::Int::one() << Self::significand_bits());
46-
(Self::Int::one() - shift as Self::Int, significand << shift as Self::Int)
44+
- Self::Int::leading_zeros(1 << Self::significand_bits());
45+
(1 - shift as Self::Int, significand << shift as Self::Int)
4746
}
4847
}
4948
impl Float for f64 {
@@ -62,7 +61,7 @@ impl Float for f64 {
6261
}
6362
fn normalize(significand: Self::Int) -> (Self::Int, Self::Int) {
6463
let shift = Self::Int::leading_zeros(significand)
65-
- Self::Int::leading_zeros(Self::Int::one() << Self::significand_bits());
66-
(Self::Int::one() - shift as Self::Int, significand << shift as Self::Int)
64+
- Self::Int::leading_zeros(1 << Self::significand_bits());
65+
(1 - shift as Self::Int, significand << shift as Self::Int)
6766
}
6867
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![feature(core_intrinsics)]
33
#![feature(linkage)]
44
#![feature(naked_functions)]
5-
#![feature(zero_one)]
65
#![cfg_attr(not(test), no_std)]
76
#![no_builtins]
87
// TODO(rust-lang/rust#35021) uncomment when that PR lands

0 commit comments

Comments
 (0)