@@ -125,14 +125,6 @@ struct fltSemantics {
125
125
126
126
/* Whether this semantics can represent signed values */
127
127
bool hasSignedRepr = true ;
128
-
129
- // Returns true if any number described by this semantics can be precisely
130
- // represented by the specified semantics. Does not take into account
131
- // the value of fltNonfiniteBehavior.
132
- bool isRepresentableBy (const fltSemantics &S) const {
133
- return maxExponent <= S.maxExponent && minExponent >= S.minExponent &&
134
- precision <= S.precision ;
135
- }
136
128
};
137
129
138
130
static constexpr fltSemantics semIEEEhalf = {15 , -14 , 11 , 16 };
@@ -290,6 +282,12 @@ const fltSemantics &APFloatBase::x87DoubleExtended() {
290
282
}
291
283
const fltSemantics &APFloatBase::Bogus () { return semBogus; }
292
284
285
+ bool APFloatBase::isRepresentableBy (const fltSemantics &A,
286
+ const fltSemantics &B) {
287
+ return A.maxExponent <= B.maxExponent && A.minExponent >= B.minExponent &&
288
+ A.precision <= B.precision ;
289
+ }
290
+
293
291
constexpr RoundingMode APFloatBase::rmNearestTiesToEven;
294
292
constexpr RoundingMode APFloatBase::rmTowardPositive;
295
293
constexpr RoundingMode APFloatBase::rmTowardNegative;
@@ -5527,7 +5525,7 @@ APFloat::opStatus APFloat::convertToInteger(APSInt &result,
5527
5525
double APFloat::convertToDouble () const {
5528
5526
if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEdouble)
5529
5527
return getIEEE ().convertToDouble ();
5530
- assert (getSemantics (). isRepresentableBy ( semIEEEdouble) &&
5528
+ assert (isRepresentableBy ( getSemantics (), semIEEEdouble) &&
5531
5529
" Float semantics is not representable by IEEEdouble" );
5532
5530
APFloat Temp = *this ;
5533
5531
bool LosesInfo;
@@ -5541,7 +5539,7 @@ double APFloat::convertToDouble() const {
5541
5539
float128 APFloat::convertToQuad () const {
5542
5540
if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEquad)
5543
5541
return getIEEE ().convertToQuad ();
5544
- assert (getSemantics (). isRepresentableBy ( semIEEEquad) &&
5542
+ assert (isRepresentableBy ( getSemantics (), semIEEEquad) &&
5545
5543
" Float semantics is not representable by IEEEquad" );
5546
5544
APFloat Temp = *this ;
5547
5545
bool LosesInfo;
@@ -5555,7 +5553,7 @@ float128 APFloat::convertToQuad() const {
5555
5553
float APFloat::convertToFloat () const {
5556
5554
if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEsingle)
5557
5555
return getIEEE ().convertToFloat ();
5558
- assert (getSemantics (). isRepresentableBy ( semIEEEsingle) &&
5556
+ assert (isRepresentableBy ( getSemantics (), semIEEEsingle) &&
5559
5557
" Float semantics is not representable by IEEEsingle" );
5560
5558
APFloat Temp = *this ;
5561
5559
bool LosesInfo;
0 commit comments