@@ -125,14 +125,6 @@ struct fltSemantics {
125125
126126 /* Whether this semantics can represent signed values */
127127 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- }
136128};
137129
138130static constexpr fltSemantics semIEEEhalf = {15 , -14 , 11 , 16 };
@@ -290,6 +282,12 @@ const fltSemantics &APFloatBase::x87DoubleExtended() {
290282}
291283const fltSemantics &APFloatBase::Bogus () { return semBogus; }
292284
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+
293291constexpr RoundingMode APFloatBase::rmNearestTiesToEven;
294292constexpr RoundingMode APFloatBase::rmTowardPositive;
295293constexpr RoundingMode APFloatBase::rmTowardNegative;
@@ -5527,7 +5525,7 @@ APFloat::opStatus APFloat::convertToInteger(APSInt &result,
55275525double APFloat::convertToDouble () const {
55285526 if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEdouble)
55295527 return getIEEE ().convertToDouble ();
5530- assert (getSemantics (). isRepresentableBy ( semIEEEdouble) &&
5528+ assert (isRepresentableBy ( getSemantics (), semIEEEdouble) &&
55315529 " Float semantics is not representable by IEEEdouble" );
55325530 APFloat Temp = *this ;
55335531 bool LosesInfo;
@@ -5541,7 +5539,7 @@ double APFloat::convertToDouble() const {
55415539float128 APFloat::convertToQuad () const {
55425540 if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEquad)
55435541 return getIEEE ().convertToQuad ();
5544- assert (getSemantics (). isRepresentableBy ( semIEEEquad) &&
5542+ assert (isRepresentableBy ( getSemantics (), semIEEEquad) &&
55455543 " Float semantics is not representable by IEEEquad" );
55465544 APFloat Temp = *this ;
55475545 bool LosesInfo;
@@ -5555,7 +5553,7 @@ float128 APFloat::convertToQuad() const {
55555553float APFloat::convertToFloat () const {
55565554 if (&getSemantics () == (const llvm::fltSemantics *)&semIEEEsingle)
55575555 return getIEEE ().convertToFloat ();
5558- assert (getSemantics (). isRepresentableBy ( semIEEEsingle) &&
5556+ assert (isRepresentableBy ( getSemantics (), semIEEEsingle) &&
55595557 " Float semantics is not representable by IEEEsingle" );
55605558 APFloat Temp = *this ;
55615559 bool LosesInfo;
0 commit comments