@@ -70,10 +70,10 @@ pub(crate) trait Float:
70
70
const EXPONENT_MASK : Self :: Int ;
71
71
72
72
/// Returns `self` transmuted to `Self::Int`
73
- fn repr ( self ) -> Self :: Int ;
73
+ fn to_bits ( self ) -> Self :: Int ;
74
74
75
75
/// Returns `self` transmuted to `Self::SignedInt`
76
- fn signed_repr ( self ) -> Self :: SignedInt ;
76
+ fn to_bits_signed ( self ) -> Self :: SignedInt ;
77
77
78
78
/// Checks if two floats have the same bit representation. *Except* for NaNs! NaN can be
79
79
/// represented in multiple different ways. This method returns `true` if two NaNs are
@@ -93,10 +93,10 @@ pub(crate) trait Float:
93
93
fn imp_frac( self ) -> Self :: Int ;
94
94
95
95
/// Returns a `Self::Int` transmuted back to `Self`
96
- fn from_repr ( a: Self :: Int ) -> Self ;
96
+ fn from_bits ( a: Self :: Int ) -> Self ;
97
97
98
98
/// Constructs a `Self` from its parts. Inputs are treated as bits and shifted into position.
99
- fn from_parts( sign : bool , exponent: Self :: Int , significand: Self :: Int ) -> Self ;
99
+ fn from_parts( negative : bool , exponent: Self :: Int , significand: Self :: Int ) -> Self ;
100
100
101
101
/// Returns (normalized exponent, normalized significand)
102
102
fn normalize( significand: Self :: Int ) -> ( i32 , Self :: Int ) ;
@@ -124,10 +124,10 @@ macro_rules! float_impl {
124
124
const IMPLICIT_BIT : Self :: Int = 1 << Self :: SIGNIFICAND_BITS ;
125
125
const EXPONENT_MASK : Self :: Int = !( Self :: SIGN_MASK | Self :: SIGNIFICAND_MASK ) ;
126
126
127
- fn repr ( self ) -> Self :: Int {
127
+ fn to_bits ( self ) -> Self :: Int {
128
128
self . to_bits( )
129
129
}
130
- fn signed_repr ( self ) -> Self :: SignedInt {
130
+ fn to_bits_signed ( self ) -> Self :: SignedInt {
131
131
self . to_bits( ) as Self :: SignedInt
132
132
}
133
133
fn eq_repr( self , rhs: Self ) -> bool {
@@ -137,8 +137,8 @@ macro_rules! float_impl {
137
137
// necessary builtin (__unordtf2) to test whether `f128` is NaN.
138
138
// FIXME(f16_f128): Remove once the nightly toolchain has the __unordtf2 builtin
139
139
// x is NaN if all the bits of the exponent are set and the significand is non-0
140
- x. repr ( ) & $ty:: EXPONENT_MASK == $ty:: EXPONENT_MASK
141
- && x. repr ( ) & $ty:: SIGNIFICAND_MASK != 0
140
+ x. to_bits ( ) & $ty:: EXPONENT_MASK == $ty:: EXPONENT_MASK
141
+ && x. to_bits ( ) & $ty:: SIGNIFICAND_MASK != 0
142
142
}
143
143
#[ cfg( not( feature = "mangled-names" ) ) ]
144
144
fn is_nan( x: $ty) -> bool {
@@ -147,7 +147,7 @@ macro_rules! float_impl {
147
147
if is_nan( self ) && is_nan( rhs) {
148
148
true
149
149
} else {
150
- self . repr ( ) == rhs. repr ( )
150
+ self . to_bits ( ) == rhs. to_bits ( )
151
151
}
152
152
}
153
153
fn is_sign_negative( self ) -> bool {
@@ -162,12 +162,12 @@ macro_rules! float_impl {
162
162
fn imp_frac( self ) -> Self :: Int {
163
163
self . frac( ) | Self :: IMPLICIT_BIT
164
164
}
165
- fn from_repr ( a: Self :: Int ) -> Self {
165
+ fn from_bits ( a: Self :: Int ) -> Self {
166
166
Self :: from_bits( a)
167
167
}
168
- fn from_parts( sign : bool , exponent: Self :: Int , significand: Self :: Int ) -> Self {
169
- Self :: from_repr (
170
- ( ( sign as Self :: Int ) << ( Self :: BITS - 1 ) )
168
+ fn from_parts( negative : bool , exponent: Self :: Int , significand: Self :: Int ) -> Self {
169
+ Self :: from_bits (
170
+ ( ( negative as Self :: Int ) << ( Self :: BITS - 1 ) )
171
171
| ( ( exponent << Self :: SIGNIFICAND_BITS ) & Self :: EXPONENT_MASK )
172
172
| ( significand & Self :: SIGNIFICAND_MASK ) ,
173
173
)
@@ -182,7 +182,7 @@ macro_rules! float_impl {
182
182
)
183
183
}
184
184
fn is_subnormal( self ) -> bool {
185
- ( self . repr ( ) & Self :: EXPONENT_MASK ) == Self :: Int :: ZERO
185
+ ( self . to_bits ( ) & Self :: EXPONENT_MASK ) == Self :: Int :: ZERO
186
186
}
187
187
}
188
188
} ;
0 commit comments