1
1
use core:: mem:: transmute;
2
- use core:: num:: One ;
3
2
use core:: ops:: * ;
4
3
5
4
pub mod add;
@@ -8,7 +7,7 @@ pub mod add;
8
7
pub trait Float : Sized {
9
8
/// A uint of the same with as the float
10
9
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 > ;
12
11
13
12
/// Returns the bitwidth of the float type
14
13
fn bits ( ) -> u32 ;
@@ -42,8 +41,8 @@ impl Float for f32 {
42
41
}
43
42
fn normalize ( significand : Self :: Int ) -> ( Self :: Int , Self :: Int ) {
44
43
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 )
47
46
}
48
47
}
49
48
impl Float for f64 {
@@ -62,7 +61,7 @@ impl Float for f64 {
62
61
}
63
62
fn normalize ( significand : Self :: Int ) -> ( Self :: Int , Self :: Int ) {
64
63
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 )
67
66
}
68
67
}
0 commit comments