зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
This commit is contained in:
Родитель
52e361ff92
Коммит
10f49d4180
|
@ -785,13 +785,13 @@ mozilla::java::GeckoBundle::LocalRef SessionAccessibility::ToBundle(
|
|||
java::sdk::Integer::ValueOf(0)); // integer
|
||||
}
|
||||
|
||||
if (!IsNaN(aCurVal)) {
|
||||
if (!std::isnan(aCurVal)) {
|
||||
GECKOBUNDLE_PUT(rangeInfo, "current", java::sdk::Double::New(aCurVal));
|
||||
}
|
||||
if (!IsNaN(aMinVal)) {
|
||||
if (!std::isnan(aMinVal)) {
|
||||
GECKOBUNDLE_PUT(rangeInfo, "min", java::sdk::Double::New(aMinVal));
|
||||
}
|
||||
if (!IsNaN(aMaxVal)) {
|
||||
if (!std::isnan(aMaxVal)) {
|
||||
GECKOBUNDLE_PUT(rangeInfo, "max", java::sdk::Double::New(aMaxVal));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ static void getCurrentValueCB(AtkValue* obj, GValue* value) {
|
|||
|
||||
memset(value, 0, sizeof(GValue));
|
||||
double accValue = acc->CurValue();
|
||||
if (IsNaN(accValue)) return;
|
||||
if (std::isnan(accValue)) return;
|
||||
|
||||
g_value_init(value, G_TYPE_DOUBLE);
|
||||
g_value_set_double(value, accValue);
|
||||
|
@ -39,7 +39,7 @@ static void getMaximumValueCB(AtkValue* obj, GValue* value) {
|
|||
|
||||
memset(value, 0, sizeof(GValue));
|
||||
double accValue = acc->MaxValue();
|
||||
if (IsNaN(accValue)) return;
|
||||
if (std::isnan(accValue)) return;
|
||||
|
||||
g_value_init(value, G_TYPE_DOUBLE);
|
||||
g_value_set_double(value, accValue);
|
||||
|
@ -53,7 +53,7 @@ static void getMinimumValueCB(AtkValue* obj, GValue* value) {
|
|||
|
||||
memset(value, 0, sizeof(GValue));
|
||||
double accValue = acc->MinValue();
|
||||
if (IsNaN(accValue)) return;
|
||||
if (std::isnan(accValue)) return;
|
||||
|
||||
g_value_init(value, G_TYPE_DOUBLE);
|
||||
g_value_set_double(value, accValue);
|
||||
|
@ -67,7 +67,7 @@ static void getMinimumIncrementCB(AtkValue* obj, GValue* minimumIncrement) {
|
|||
|
||||
memset(minimumIncrement, 0, sizeof(GValue));
|
||||
double accValue = acc->Step();
|
||||
if (IsNaN(accValue)) {
|
||||
if (std::isnan(accValue)) {
|
||||
accValue = 0; // zero if the minimum increment is undefined
|
||||
}
|
||||
|
||||
|
|
|
@ -1657,7 +1657,7 @@ void LocalAccessible::Value(nsString& aValue) const {
|
|||
nsGkAtoms::aria_valuetext, aValue)) {
|
||||
if (!NativeHasNumericValue()) {
|
||||
double checkValue = CurValue();
|
||||
if (!IsNaN(checkValue)) {
|
||||
if (!std::isnan(checkValue)) {
|
||||
aValue.AppendFloat(checkValue);
|
||||
}
|
||||
}
|
||||
|
@ -1699,7 +1699,7 @@ void LocalAccessible::Value(nsString& aValue) const {
|
|||
|
||||
double LocalAccessible::MaxValue() const {
|
||||
double checkValue = AttrNumericValue(nsGkAtoms::aria_valuemax);
|
||||
if (IsNaN(checkValue) && !NativeHasNumericValue()) {
|
||||
if (std::isnan(checkValue) && !NativeHasNumericValue()) {
|
||||
// aria-valuemax isn't present and this element doesn't natively provide a
|
||||
// maximum value. Use the ARIA default.
|
||||
const nsRoleMapEntry* roleMap = ARIARoleMap();
|
||||
|
@ -1713,7 +1713,7 @@ double LocalAccessible::MaxValue() const {
|
|||
|
||||
double LocalAccessible::MinValue() const {
|
||||
double checkValue = AttrNumericValue(nsGkAtoms::aria_valuemin);
|
||||
if (IsNaN(checkValue) && !NativeHasNumericValue()) {
|
||||
if (std::isnan(checkValue) && !NativeHasNumericValue()) {
|
||||
// aria-valuemin isn't present and this element doesn't natively provide a
|
||||
// minimum value. Use the ARIA default.
|
||||
const nsRoleMapEntry* roleMap = ARIARoleMap();
|
||||
|
@ -1731,7 +1731,7 @@ double LocalAccessible::Step() const {
|
|||
|
||||
double LocalAccessible::CurValue() const {
|
||||
double checkValue = AttrNumericValue(nsGkAtoms::aria_valuenow);
|
||||
if (IsNaN(checkValue) && !NativeHasNumericValue()) {
|
||||
if (std::isnan(checkValue) && !NativeHasNumericValue()) {
|
||||
// aria-valuenow isn't present and this element doesn't natively provide a
|
||||
// current value. Use the ARIA default.
|
||||
const nsRoleMapEntry* roleMap = ARIARoleMap();
|
||||
|
@ -1753,10 +1753,10 @@ bool LocalAccessible::SetCurValue(double aValue) {
|
|||
if (State() & kValueCannotChange) return false;
|
||||
|
||||
double checkValue = MinValue();
|
||||
if (!IsNaN(checkValue) && aValue < checkValue) return false;
|
||||
if (!std::isnan(checkValue) && aValue < checkValue) return false;
|
||||
|
||||
checkValue = MaxValue();
|
||||
if (!IsNaN(checkValue) && aValue > checkValue) return false;
|
||||
if (!std::isnan(checkValue) && aValue > checkValue) return false;
|
||||
|
||||
nsAutoString strValue;
|
||||
strValue.AppendFloat(aValue);
|
||||
|
|
|
@ -532,28 +532,28 @@ void HTMLSpinnerAccessible::Value(nsString& aValue) const {
|
|||
|
||||
double HTMLSpinnerAccessible::MaxValue() const {
|
||||
double value = HTMLTextFieldAccessible::MaxValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
|
||||
}
|
||||
|
||||
double HTMLSpinnerAccessible::MinValue() const {
|
||||
double value = HTMLTextFieldAccessible::MinValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
|
||||
}
|
||||
|
||||
double HTMLSpinnerAccessible::Step() const {
|
||||
double value = HTMLTextFieldAccessible::Step();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
|
||||
}
|
||||
|
||||
double HTMLSpinnerAccessible::CurValue() const {
|
||||
double value = HTMLTextFieldAccessible::CurValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
|
||||
}
|
||||
|
@ -583,28 +583,28 @@ void HTMLRangeAccessible::Value(nsString& aValue) const {
|
|||
|
||||
double HTMLRangeAccessible::MaxValue() const {
|
||||
double value = LeafAccessible::MaxValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetMaximum().toDouble();
|
||||
}
|
||||
|
||||
double HTMLRangeAccessible::MinValue() const {
|
||||
double value = LeafAccessible::MinValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetMinimum().toDouble();
|
||||
}
|
||||
|
||||
double HTMLRangeAccessible::Step() const {
|
||||
double value = LeafAccessible::Step();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetStep().toDouble();
|
||||
}
|
||||
|
||||
double HTMLRangeAccessible::CurValue() const {
|
||||
double value = LeafAccessible::CurValue();
|
||||
if (!IsNaN(value)) return value;
|
||||
if (!std::isnan(value)) return value;
|
||||
|
||||
return HTMLInputElement::FromNode(mContent)->GetValueAsDecimal().toDouble();
|
||||
}
|
||||
|
@ -771,12 +771,12 @@ void HTMLProgressAccessible::Value(nsString& aValue) const {
|
|||
}
|
||||
|
||||
double maxValue = MaxValue();
|
||||
if (IsNaN(maxValue) || maxValue == 0) {
|
||||
if (std::isnan(maxValue) || maxValue == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
double curValue = CurValue();
|
||||
if (IsNaN(curValue)) {
|
||||
if (std::isnan(curValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ void HTMLProgressAccessible::Value(nsString& aValue) const {
|
|||
|
||||
double HTMLProgressAccessible::MaxValue() const {
|
||||
double value = LeafAccessible::MaxValue();
|
||||
if (!IsNaN(value)) {
|
||||
if (!std::isnan(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -809,17 +809,17 @@ double HTMLProgressAccessible::MaxValue() const {
|
|||
|
||||
double HTMLProgressAccessible::MinValue() const {
|
||||
double value = LeafAccessible::MinValue();
|
||||
return IsNaN(value) ? 0 : value;
|
||||
return std::isnan(value) ? 0 : value;
|
||||
}
|
||||
|
||||
double HTMLProgressAccessible::Step() const {
|
||||
double value = LeafAccessible::Step();
|
||||
return IsNaN(value) ? 0 : value;
|
||||
return std::isnan(value) ? 0 : value;
|
||||
}
|
||||
|
||||
double HTMLProgressAccessible::CurValue() const {
|
||||
double value = LeafAccessible::CurValue();
|
||||
if (!IsNaN(value)) {
|
||||
if (!std::isnan(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -883,7 +883,7 @@ void HTMLMeterAccessible::Value(nsString& aValue) const {
|
|||
|
||||
// If no inner text is found, use curValue
|
||||
double curValue = CurValue();
|
||||
if (IsNaN(curValue)) {
|
||||
if (std::isnan(curValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -894,7 +894,7 @@ double HTMLMeterAccessible::MaxValue() const {
|
|||
double max = LeafAccessible::MaxValue();
|
||||
double min = MinValue();
|
||||
|
||||
if (!IsNaN(max)) {
|
||||
if (!std::isnan(max)) {
|
||||
return max > min ? max : min;
|
||||
}
|
||||
|
||||
|
@ -914,7 +914,7 @@ double HTMLMeterAccessible::MaxValue() const {
|
|||
|
||||
double HTMLMeterAccessible::MinValue() const {
|
||||
double min = LeafAccessible::MinValue();
|
||||
if (!IsNaN(min)) {
|
||||
if (!std::isnan(min)) {
|
||||
return min;
|
||||
}
|
||||
|
||||
|
@ -935,7 +935,7 @@ double HTMLMeterAccessible::CurValue() const {
|
|||
double value = LeafAccessible::CurValue();
|
||||
double minValue = MinValue();
|
||||
|
||||
if (IsNaN(value)) {
|
||||
if (std::isnan(value)) {
|
||||
/* If we didn't find a value from the LeafAccessible call above, check
|
||||
* for a value attribute */
|
||||
nsAutoString attrValue;
|
||||
|
|
|
@ -243,7 +243,7 @@ void RemoteAccessibleBase<Derived>::Value(nsString& aValue) const {
|
|||
|
||||
if (HasNumericValue()) {
|
||||
double checkValue = CurValue();
|
||||
if (!IsNaN(checkValue)) {
|
||||
if (!std::isnan(checkValue)) {
|
||||
aValue.AppendFloat(checkValue);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -218,8 +218,7 @@ using namespace mozilla::a11y;
|
|||
double min = mGeckoAccessible->MinValue();
|
||||
double max = mGeckoAccessible->MaxValue();
|
||||
|
||||
if ((mozilla::IsNaN(min) || value >= min) &&
|
||||
(mozilla::IsNaN(max) || value <= max)) {
|
||||
if ((std::isnan(min) || value >= min) && (std::isnan(max) || value <= max)) {
|
||||
if (LocalAccessible* acc = mGeckoAccessible->AsLocal()) {
|
||||
acc->SetCurValue(value);
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,7 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue) {
|
|||
|
||||
currentValue = valueAcc->CurValue();
|
||||
|
||||
if (IsNaN(currentValue)) return S_FALSE;
|
||||
if (std::isnan(currentValue)) return S_FALSE;
|
||||
|
||||
aCurrentValue->vt = VT_R8;
|
||||
aCurrentValue->dblVal = currentValue;
|
||||
|
@ -96,7 +96,7 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue) {
|
|||
|
||||
maximumValue = valueAcc->MaxValue();
|
||||
|
||||
if (IsNaN(maximumValue)) return S_FALSE;
|
||||
if (std::isnan(maximumValue)) return S_FALSE;
|
||||
|
||||
aMaximumValue->vt = VT_R8;
|
||||
aMaximumValue->dblVal = maximumValue;
|
||||
|
@ -117,7 +117,7 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue) {
|
|||
|
||||
minimumValue = valueAcc->MinValue();
|
||||
|
||||
if (IsNaN(minimumValue)) return S_FALSE;
|
||||
if (std::isnan(minimumValue)) return S_FALSE;
|
||||
|
||||
aMinimumValue->vt = VT_R8;
|
||||
aMinimumValue->dblVal = minimumValue;
|
||||
|
|
|
@ -24,7 +24,7 @@ xpcAccessibleValue::GetMaximumValue(double* aValue) {
|
|||
|
||||
double value = Intl()->MaxValue();
|
||||
|
||||
if (!IsNaN(value)) *aValue = value;
|
||||
if (!std::isnan(value)) *aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ xpcAccessibleValue::GetMinimumValue(double* aValue) {
|
|||
|
||||
double value = Intl()->MinValue();
|
||||
|
||||
if (!IsNaN(value)) *aValue = value;
|
||||
if (!std::isnan(value)) *aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ xpcAccessibleValue::GetCurrentValue(double* aValue) {
|
|||
|
||||
double value = Intl()->CurValue();
|
||||
|
||||
if (!IsNaN(value)) *aValue = value;
|
||||
if (!std::isnan(value)) *aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ xpcAccessibleValue::GetMinimumIncrement(double* aValue) {
|
|||
|
||||
double value = Intl()->Step();
|
||||
|
||||
if (!IsNaN(value)) *aValue = value;
|
||||
if (!std::isnan(value)) *aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ void NaNExprChecker::registerMatchers(MatchFinder *AstMatcher) {
|
|||
|
||||
void NaNExprChecker::check(const MatchFinder::MatchResult &Result) {
|
||||
if (!Result.Context->getLangOpts().CPlusPlus) {
|
||||
// mozilla::IsNaN is not usable in C, so there is no point in issuing these
|
||||
// warnings.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,7 +48,7 @@ void NaNExprChecker::check(const MatchFinder::MatchResult &Result) {
|
|||
"comparing a floating point value to itself for "
|
||||
"NaN checking can lead to incorrect results",
|
||||
DiagnosticIDs::Error);
|
||||
diag(Expression->getBeginLoc(), "consider using mozilla::IsNaN instead",
|
||||
diag(Expression->getBeginLoc(), "consider using std::isnan instead",
|
||||
DiagnosticIDs::Note);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ void foo() {
|
|||
typedef double mydouble;
|
||||
mydouble d;
|
||||
double d2;
|
||||
test(f == f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
|
||||
test(d == d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
|
||||
test(f != f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
|
||||
test(d != d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using mozilla::IsNaN instead}}
|
||||
test(f == f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
|
||||
test(d == d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
|
||||
test(f != f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
|
||||
test(d != d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
|
||||
test(f != d);
|
||||
test(d == (d - f));
|
||||
test(f == f2);
|
||||
|
|
|
@ -114,7 +114,7 @@ ComputedTiming AnimationEffect::GetComputedTimingAt(
|
|||
result.mDuration = aTiming.Duration().ref();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aTiming.Iterations() >= 0.0 && !IsNaN(aTiming.Iterations()),
|
||||
MOZ_ASSERT(aTiming.Iterations() >= 0.0 && !std::isnan(aTiming.Iterations()),
|
||||
"mIterations should be nonnegative & finite, as ensured by "
|
||||
"ValidateIterations or CSSParser");
|
||||
result.mIterations = aTiming.Iterations();
|
||||
|
|
|
@ -108,7 +108,7 @@ struct TimingParams {
|
|||
}
|
||||
|
||||
static void ValidateIterations(double aIterations, ErrorResult& aRv) {
|
||||
if (IsNaN(aIterations)) {
|
||||
if (std::isnan(aIterations)) {
|
||||
aRv.ThrowTypeError("Iterations must not be NaN");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ inline bool PrimitiveConversionTraits_Clamp(JSContext* cx,
|
|||
static_assert(std::numeric_limits<T>::is_integer,
|
||||
"This can only be applied to integers!");
|
||||
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
*retval = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4195,7 +4195,7 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
|
|||
// According to spec, the API should return an empty array if maxWidth was
|
||||
// provided but is less than or equal to zero or equal to NaN.
|
||||
if (aMaxWidth.WasPassed() &&
|
||||
(aMaxWidth.Value() <= 0 || IsNaN(aMaxWidth.Value()))) {
|
||||
(aMaxWidth.Value() <= 0 || std::isnan(aMaxWidth.Value()))) {
|
||||
textToDraw.Truncate();
|
||||
}
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ void WebGLContext::ErrorInvalidEnumInfo(const char* const info,
|
|||
#ifdef DEBUG
|
||||
// For NaNs, etc.
|
||||
static bool IsCacheCorrect(float cached, float actual) {
|
||||
if (IsNaN(cached)) {
|
||||
if (std::isnan(cached)) {
|
||||
// GL is allowed to do anything it wants for NaNs, so if we're shadowing
|
||||
// a NaN, then whatever `actual` is might be correct.
|
||||
return true;
|
||||
|
|
|
@ -47,7 +47,7 @@ JSObject* GeolocationCoordinates::WrapObject(
|
|||
double value; \
|
||||
mCoords->Get##name(&value); \
|
||||
Nullable<double> rv; \
|
||||
if (!IsNaN(value)) { \
|
||||
if (!std::isnan(value)) { \
|
||||
rv.SetValue(value); \
|
||||
} \
|
||||
return rv; \
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "mozilla/dom/GeolocationPositionBinding.h"
|
||||
|
||||
using mozilla::EqualOrBothNaN;
|
||||
using mozilla::IsNaN;
|
||||
|
||||
// NaN() is a more convenient function name.
|
||||
inline double NaN() { return mozilla::UnspecifiedNaN<double>(); }
|
||||
|
@ -28,7 +27,7 @@ nsGeoPositionCoords::nsGeoPositionCoords(double aLat, double aLong, double aAlt,
|
|||
mHError((aHError >= 0) ? aHError : 0)
|
||||
// altitudeAccuracy without an altitude doesn't make any sense.
|
||||
,
|
||||
mVError((aVError >= 0 && !IsNaN(aAlt)) ? aVError : NaN())
|
||||
mVError((aVError >= 0 && !std::isnan(aAlt)) ? aVError : NaN())
|
||||
// If the hosting device is stationary (i.e. the value of the speed
|
||||
// attribute is 0), then the value of the heading attribute must be NaN
|
||||
// (or null).
|
||||
|
|
|
@ -1832,7 +1832,7 @@ void HTMLInputElement::SetValueAsDate(JSContext* aCx,
|
|||
// At this point we know we're not a file input, so we can just pass "not
|
||||
// system" as the caller type, since the caller type only matters in the file
|
||||
// input case.
|
||||
if (IsNaN(milliseconds)) {
|
||||
if (std::isnan(milliseconds)) {
|
||||
SetValue(u""_ns, CallerType::NonSystem, aRv);
|
||||
return;
|
||||
}
|
||||
|
@ -1846,7 +1846,7 @@ void HTMLInputElement::SetValueAsDate(JSContext* aCx,
|
|||
double year = JS::YearFromTime(milliseconds);
|
||||
double month = JS::MonthFromTime(milliseconds);
|
||||
|
||||
if (IsNaN(year) || IsNaN(month)) {
|
||||
if (std::isnan(year) || std::isnan(month)) {
|
||||
SetValue(u""_ns, CallerType::NonSystem, aRv);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3174,7 +3174,7 @@ void HTMLMediaElement::Seek(double aTime, SeekTarget::Type aSeekType,
|
|||
// synchronous errors are returned using aRv, not promise rejections.
|
||||
|
||||
// aTime should be non-NaN.
|
||||
MOZ_ASSERT(!mozilla::IsNaN(aTime));
|
||||
MOZ_ASSERT(!std::isnan(aTime));
|
||||
|
||||
// Seeking step1, Set the media element's show poster flag to false.
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-seek
|
||||
|
|
|
@ -192,7 +192,7 @@ bool DateInputType::ConvertNumberToString(Decimal aValue,
|
|||
double month = JS::MonthFromTime(aValue.toDouble());
|
||||
double day = JS::DayFromTime(aValue.toDouble());
|
||||
|
||||
if (IsNaN(year) || IsNaN(month) || IsNaN(day)) {
|
||||
if (std::isnan(year) || std::isnan(month) || std::isnan(day)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ bool DateTimeLocalInputType::ConvertNumberToString(
|
|||
double month = JS::MonthFromTime(aValue.toDouble());
|
||||
double day = JS::DayFromTime(aValue.toDouble());
|
||||
|
||||
if (IsNaN(year) || IsNaN(month) || IsNaN(day)) {
|
||||
if (std::isnan(year) || std::isnan(month) || std::isnan(day)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ IDBResult<Ok, IDBSpecialValue::Invalid> Key::EncodeJSValInternal(
|
|||
const auto number = aVal.toNumber();
|
||||
|
||||
// 1. If `input` is NaN then return invalid.
|
||||
if (mozilla::IsNaN(number)) {
|
||||
if (std::isnan(number)) {
|
||||
return Err(IDBError(SpecialValues::Invalid));
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ IDBResult<Ok, IDBSpecialValue::Invalid> Key::EncodeJSValInternal(
|
|||
}
|
||||
|
||||
// 2. If `ms` is NaN then return invalid.
|
||||
if (mozilla::IsNaN(ms)) {
|
||||
if (std::isnan(ms)) {
|
||||
return Err(IDBError(SpecialValues::Invalid));
|
||||
}
|
||||
|
||||
|
|
|
@ -1038,7 +1038,7 @@ void MediaDecoder::DurationChanged() {
|
|||
mDuration = mStateMachineDuration.Ref().ref().ToSeconds();
|
||||
}
|
||||
|
||||
if (mDuration == oldDuration || IsNaN(mDuration)) {
|
||||
if (mDuration == oldDuration || std::isnan(mDuration)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ bool MediaDecoder::IsMediaSeekable() {
|
|||
media::TimeIntervals MediaDecoder::GetSeekable() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (IsNaN(GetDuration())) {
|
||||
if (std::isnan(GetDuration())) {
|
||||
// We do not have a duration yet, we can't determine the seekable range.
|
||||
return TimeIntervals();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static const int64_t NSECS_PER_S = 1000000000;
|
|||
class TimeUnit final {
|
||||
public:
|
||||
static TimeUnit FromSeconds(double aValue) {
|
||||
MOZ_ASSERT(!IsNaN(aValue));
|
||||
MOZ_ASSERT(!std::isnan(aValue));
|
||||
|
||||
if (mozilla::IsInfinite<double>(aValue)) {
|
||||
return aValue > 0 ? FromInfinity() : FromNegativeInfinity();
|
||||
|
@ -154,7 +154,7 @@ class TimeUnit final {
|
|||
// +/-Inf, or NaN. So do the calculation in floating point for
|
||||
// simplicity.
|
||||
double result = ToSeconds() + aOther.ToSeconds();
|
||||
return IsNaN(result) ? TimeUnit::Invalid() : FromSeconds(result);
|
||||
return std::isnan(result) ? TimeUnit::Invalid() : FromSeconds(result);
|
||||
}
|
||||
return TimeUnit(mValue + aOther.mValue);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class TimeUnit final {
|
|||
// +/-Inf, or NaN. So do the calculation in floating point for
|
||||
// simplicity.
|
||||
double result = ToSeconds() - aOther.ToSeconds();
|
||||
return IsNaN(result) ? TimeUnit::Invalid() : FromSeconds(result);
|
||||
return std::isnan(result) ? TimeUnit::Invalid() : FromSeconds(result);
|
||||
}
|
||||
MOZ_ASSERT(!IsInfinite() && !aOther.IsInfinite());
|
||||
return TimeUnit(mValue - aOther.mValue);
|
||||
|
|
|
@ -248,7 +248,7 @@ double MediaSource::Duration() {
|
|||
|
||||
void MediaSource::SetDuration(double aDuration, ErrorResult& aRv) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (aDuration < 0 || IsNaN(aDuration)) {
|
||||
if (aDuration < 0 || std::isnan(aDuration)) {
|
||||
nsPrintfCString error("Invalid duration value %f", aDuration);
|
||||
MSE_API("SetDuration(aDuration=%f, invalid value)", aDuration);
|
||||
aRv.ThrowTypeError(error);
|
||||
|
|
|
@ -88,7 +88,7 @@ media::TimeIntervals MediaSourceDecoder::GetSeekable() {
|
|||
|
||||
media::TimeIntervals seekable;
|
||||
double duration = mMediaSource->Duration();
|
||||
if (IsNaN(duration)) {
|
||||
if (std::isnan(duration)) {
|
||||
// Return empty range.
|
||||
} else if (duration > 0 && mozilla::IsInfinite(duration)) {
|
||||
media::TimeIntervals buffered = GetBuffered();
|
||||
|
@ -207,7 +207,7 @@ void MediaSourceDecoder::SetInitialDuration(int64_t aDuration) {
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// Only use the decoded duration if one wasn't already
|
||||
// set.
|
||||
if (!mMediaSource || !IsNaN(ExplicitDuration())) {
|
||||
if (!mMediaSource || !std::isnan(ExplicitDuration())) {
|
||||
return;
|
||||
}
|
||||
double duration = aDuration;
|
||||
|
@ -288,7 +288,7 @@ bool MediaSourceDecoder::CanPlayThroughImpl() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IsNaN(mMediaSource->Duration())) {
|
||||
if (std::isnan(mMediaSource->Duration())) {
|
||||
// Don't have any data yet.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void SourceBuffer::SetAppendWindowEnd(double aAppendWindowEnd,
|
|||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
if (IsNaN(aAppendWindowEnd) ||
|
||||
if (std::isnan(aAppendWindowEnd) ||
|
||||
aAppendWindowEnd <= mCurrentAttributes.GetAppendWindowStart()) {
|
||||
aRv.ThrowTypeError("Invalid appendWindowEnd value");
|
||||
return;
|
||||
|
@ -306,7 +306,7 @@ void SourceBuffer::PrepareRemove(double aStart, double aEnd, ErrorResult& aRv) {
|
|||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
if (IsNaN(mMediaSource->Duration())) {
|
||||
if (std::isnan(mMediaSource->Duration())) {
|
||||
aRv.ThrowTypeError("Duration is NaN");
|
||||
return;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ void SourceBuffer::PrepareRemove(double aStart, double aEnd, ErrorResult& aRv) {
|
|||
aRv.ThrowTypeError("Invalid start value");
|
||||
return;
|
||||
}
|
||||
if (aEnd <= aStart || IsNaN(aEnd)) {
|
||||
if (aEnd <= aStart || std::isnan(aEnd)) {
|
||||
aRv.ThrowTypeError("Invalid end value");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ class AudioBufferSourceNodeEngine final : public AudioNodeEngine {
|
|||
} else {
|
||||
detune = mDetuneTimeline.GetValueAtTime(aTrackPosition);
|
||||
}
|
||||
if (playbackRate <= 0 || mozilla::IsNaN(playbackRate)) {
|
||||
if (playbackRate <= 0 || std::isnan(playbackRate)) {
|
||||
playbackRate = 1.0f;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ inline float ConvertDecibelToLinear(float aDecibel) {
|
|||
}
|
||||
|
||||
inline void FixNaN(double& aDouble) {
|
||||
if (IsNaN(aDouble) || IsInfinite(aDouble)) {
|
||||
if (std::isnan(aDouble) || IsInfinite(aDouble)) {
|
||||
aDouble = 0.0;
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ IntType TruncateFloatToInt(FloatType f) {
|
|||
static_assert(std::is_floating_point_v<FloatType> == true,
|
||||
"FloatType must be a floating point type");
|
||||
|
||||
if (mozilla::IsNaN(f)) {
|
||||
if (std::isnan(f)) {
|
||||
// It is the responsibility of the caller to deal with NaN values.
|
||||
// If we ever get to this point, we have a serious bug to fix.
|
||||
MOZ_CRASH("We should never see a NaN here");
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
using namespace mozilla::dom; // for WebAudioUtils
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::MakeUnique;
|
||||
using mozilla::PositiveInfinity;
|
||||
|
||||
|
@ -293,7 +292,7 @@ void DynamicsCompressorKernel::process(
|
|||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Fix gremlins.
|
||||
if (IsNaN(m_detectorAverage)) m_detectorAverage = 1;
|
||||
if (std::isnan(m_detectorAverage)) m_detectorAverage = 1;
|
||||
if (IsInfinite(m_detectorAverage)) m_detectorAverage = 1;
|
||||
|
||||
float desiredGain = m_detectorAverage;
|
||||
|
@ -327,7 +326,7 @@ void DynamicsCompressorKernel::process(
|
|||
m_maxAttackCompressionDiffDb = -1;
|
||||
|
||||
// Fix gremlins.
|
||||
if (IsNaN(compressionDiffDb)) compressionDiffDb = -1;
|
||||
if (std::isnan(compressionDiffDb)) compressionDiffDb = -1;
|
||||
if (IsInfinite(compressionDiffDb)) compressionDiffDb = -1;
|
||||
|
||||
// Adaptive release - higher compression (lower compressionDiffDb)
|
||||
|
@ -355,7 +354,7 @@ void DynamicsCompressorKernel::process(
|
|||
// Attack mode - compressionDiffDb should be positive dB
|
||||
|
||||
// Fix gremlins.
|
||||
if (IsNaN(compressionDiffDb)) compressionDiffDb = 1;
|
||||
if (std::isnan(compressionDiffDb)) compressionDiffDb = 1;
|
||||
if (IsInfinite(compressionDiffDb)) compressionDiffDb = 1;
|
||||
|
||||
// As long as we're still in attack mode, use a rate based off
|
||||
|
@ -427,7 +426,7 @@ void DynamicsCompressorKernel::process(
|
|||
detectorAverage = std::min(1.0f, detectorAverage);
|
||||
|
||||
// Fix gremlins.
|
||||
if (IsNaN(detectorAverage)) detectorAverage = 1;
|
||||
if (std::isnan(detectorAverage)) detectorAverage = 1;
|
||||
if (IsInfinite(detectorAverage)) detectorAverage = 1;
|
||||
|
||||
// Exponential approach to desired gain.
|
||||
|
|
|
@ -108,7 +108,7 @@ void IIRFilter::process(const float* sourceP, float* destP,
|
|||
// Avoid introducing a stream of subnormals
|
||||
destP[n] = WebCore::DenormalDisabler::flushDenormalFloatToZero(yn);
|
||||
MOZ_ASSERT(destP[n] == 0.0 || std::fabs(destP[n]) > FLT_MIN ||
|
||||
mozilla::IsNaN(destP[n]),
|
||||
std::isnan(destP[n]),
|
||||
"output should not be subnormal, but can be NaN");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ static float calculateNormalizationScale(const nsTArray<const float*>& response,
|
|||
power = sqrt(power / (numberOfChannels * aLength));
|
||||
|
||||
// Protect against accidental overload
|
||||
if (!IsFinite(power) || IsNaN(power) || power < MinPower) power = MinPower;
|
||||
if (!IsFinite(power) || std::isnan(power) || power < MinPower)
|
||||
power = MinPower;
|
||||
|
||||
float scale = 1 / power;
|
||||
|
||||
|
|
|
@ -789,7 +789,7 @@ void GCLocProviderPriv::ConnectLocationResponse(GObject* aObject,
|
|||
if (speed < 0) {
|
||||
speed = UnspecifiedNaN<double>();
|
||||
}
|
||||
if (heading < 0 || IsNaN(speed) || speed == 0) {
|
||||
if (heading < 0 || std::isnan(speed) || speed == 0) {
|
||||
heading = UnspecifiedNaN<double>();
|
||||
}
|
||||
|
||||
|
|
|
@ -254,31 +254,31 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
|
|||
# else
|
||||
galt = gpsData.fix.altitude;
|
||||
# endif
|
||||
if (!IsNaN(galt)) {
|
||||
if (!std::isnan(galt)) {
|
||||
alt = galt;
|
||||
}
|
||||
[[fallthrough]];
|
||||
case MODE_2D:
|
||||
if (!IsNaN(gpsData.fix.latitude)) {
|
||||
if (!std::isnan(gpsData.fix.latitude)) {
|
||||
lat = gpsData.fix.latitude;
|
||||
}
|
||||
if (!IsNaN(gpsData.fix.longitude)) {
|
||||
if (!std::isnan(gpsData.fix.longitude)) {
|
||||
lon = gpsData.fix.longitude;
|
||||
}
|
||||
if (!IsNaN(gpsData.fix.epx) && !IsNaN(gpsData.fix.epy)) {
|
||||
if (!std::isnan(gpsData.fix.epx) && !std::isnan(gpsData.fix.epy)) {
|
||||
hError = std::max(gpsData.fix.epx, gpsData.fix.epy);
|
||||
} else if (!IsNaN(gpsData.fix.epx)) {
|
||||
} else if (!std::isnan(gpsData.fix.epx)) {
|
||||
hError = gpsData.fix.epx;
|
||||
} else if (!IsNaN(gpsData.fix.epy)) {
|
||||
} else if (!std::isnan(gpsData.fix.epy)) {
|
||||
hError = gpsData.fix.epy;
|
||||
}
|
||||
if (!IsNaN(gpsData.fix.epv)) {
|
||||
if (!std::isnan(gpsData.fix.epv)) {
|
||||
vError = gpsData.fix.epv;
|
||||
}
|
||||
if (!IsNaN(gpsData.fix.track)) {
|
||||
if (!std::isnan(gpsData.fix.track)) {
|
||||
heading = gpsData.fix.track;
|
||||
}
|
||||
if (!IsNaN(gpsData.fix.speed)) {
|
||||
if (!std::isnan(gpsData.fix.speed)) {
|
||||
speed = gpsData.fix.speed;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -116,7 +116,7 @@ double txDouble::toDouble(const nsAString& aSrc) {
|
|||
void txDouble::toString(double aValue, nsAString& aDest) {
|
||||
// check for special cases
|
||||
|
||||
if (mozilla::IsNaN(aValue)) {
|
||||
if (std::isnan(aValue)) {
|
||||
aDest.AppendLiteral("NaN");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// check for NaN or +/-Inf
|
||||
if (mozilla::IsNaN(start) || mozilla::IsInfinite(start) ||
|
||||
if (std::isnan(start) || mozilla::IsInfinite(start) ||
|
||||
start >= src.Length() + 0.5) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
|
@ -344,7 +344,7 @@ nsresult txCoreFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
end += start;
|
||||
if (mozilla::IsNaN(end) || end < 0) {
|
||||
if (std::isnan(end) || end < 0) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -38,11 +38,11 @@ nsresult txNumberExpr::evaluate(txIEvalContext* aContext,
|
|||
if (rightDbl == 0) {
|
||||
#if defined(XP_WIN)
|
||||
/* XXX MSVC miscompiles such that (NaN == 0) */
|
||||
if (mozilla::IsNaN(rightDbl))
|
||||
if (std::isnan(rightDbl))
|
||||
result = mozilla::UnspecifiedNaN<double>();
|
||||
else
|
||||
#endif
|
||||
if (leftDbl == 0 || mozilla::IsNaN(leftDbl))
|
||||
if (leftDbl == 0 || std::isnan(leftDbl))
|
||||
result = mozilla::UnspecifiedNaN<double>();
|
||||
else if (mozilla::IsNegative(leftDbl) != mozilla::IsNegative(rightDbl))
|
||||
result = mozilla::NegativeInfinity<double>();
|
||||
|
|
|
@ -41,7 +41,7 @@ bool NumberResult::booleanValue() {
|
|||
// OG+
|
||||
// As per the XPath spec, the boolean value of a number is true if and only if
|
||||
// it is neither positive 0 nor negative 0 nor NaN
|
||||
return (bool)(value != 0.0 && !mozilla::IsNaN(value));
|
||||
return (bool)(value != 0.0 && !std::isnan(value));
|
||||
// OG-
|
||||
} //-- booleanValue
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
nsAutoString str;
|
||||
txXPathNodeUtils::appendNodeValue(nodes->get(i), str);
|
||||
double val = txDouble::toDouble(str);
|
||||
if (mozilla::IsNaN(val)) {
|
||||
if (std::isnan(val)) {
|
||||
res = UnspecifiedNaN<double>();
|
||||
break;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
const txXPathNode& node = nodes->get(i);
|
||||
txXPathNodeUtils::appendNodeValue(node, str);
|
||||
double val = txDouble::toDouble(str);
|
||||
if (mozilla::IsNaN(val)) {
|
||||
if (std::isnan(val)) {
|
||||
resultSet->clear();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ nsresult txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
|
|||
}
|
||||
|
||||
// Special cases
|
||||
if (mozilla::IsNaN(value)) {
|
||||
if (std::isnan(value)) {
|
||||
return aContext->recycler()->getStringResult(format->mNaN, aResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -373,9 +373,9 @@ nsresult txStylesheet::addTemplate(txTemplateItem* aTemplate,
|
|||
uint32_t unionPos = 1; // only used when unionPattern is set
|
||||
while (simple) {
|
||||
double priority = aTemplate->mPrio;
|
||||
if (mozilla::IsNaN(priority)) {
|
||||
if (std::isnan(priority)) {
|
||||
priority = simple->getDefaultPriority();
|
||||
NS_ASSERTION(!mozilla::IsNaN(priority),
|
||||
NS_ASSERTION(!std::isnan(priority),
|
||||
"simple pattern without default priority");
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ static nsresult getNumberAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount,
|
|||
}
|
||||
|
||||
aNumber = txDouble::toDouble(attr->mValue);
|
||||
if (mozilla::IsNaN(aNumber) && (aRequired || !aState.fcp())) {
|
||||
if (std::isnan(aNumber) && (aRequired || !aState.fcp())) {
|
||||
// XXX ErrorReport: number parse failure
|
||||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
|
|
|
@ -163,9 +163,9 @@ int txResultNumberComparator::compareValues(txObject* aVal1, txObject* aVal2) {
|
|||
double dval1 = ((NumberValue*)aVal1)->mVal;
|
||||
double dval2 = ((NumberValue*)aVal2)->mVal;
|
||||
|
||||
if (mozilla::IsNaN(dval1)) return mozilla::IsNaN(dval2) ? 0 : -mAscending;
|
||||
if (std::isnan(dval1)) return std::isnan(dval2) ? 0 : -mAscending;
|
||||
|
||||
if (mozilla::IsNaN(dval2)) return mAscending;
|
||||
if (std::isnan(dval2)) return mAscending;
|
||||
|
||||
if (dval1 == dval2) return 0;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ nsresult txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
|
|||
|
||||
double value = result->numberValue();
|
||||
|
||||
if (mozilla::IsInfinite(value) || mozilla::IsNaN(value) || value < 0.5) {
|
||||
if (mozilla::IsInfinite(value) || std::isnan(value) || value < 0.5) {
|
||||
txDouble::toString(value, aValueString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -6225,8 +6225,8 @@ void AsyncPanZoomController::UpdateZoomConstraints(
|
|||
aConstraints.mMinZoom.scale, aConstraints.mMaxZoom.scale);
|
||||
}
|
||||
|
||||
if (IsNaN(aConstraints.mMinZoom.scale) ||
|
||||
IsNaN(aConstraints.mMaxZoom.scale)) {
|
||||
if (std::isnan(aConstraints.mMinZoom.scale) ||
|
||||
std::isnan(aConstraints.mMaxZoom.scale)) {
|
||||
NS_WARNING("APZC received zoom constraints with NaN values; dropping...");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1646,8 +1646,8 @@ struct PaintVarRotateAroundCenter : public PaintRotateAroundCenter {
|
|||
static inline Matrix SkewMatrix(float aSkewX, float aSkewY) {
|
||||
float xy = tanf(aSkewX * float(M_PI));
|
||||
float yx = tanf(aSkewY * float(M_PI));
|
||||
return IsNaN(xy) || IsNaN(yx) ? Matrix()
|
||||
: Matrix(1.0, -yx, xy, 1.0, 0.0, 0.0);
|
||||
return std::isnan(xy) || std::isnan(yx) ? Matrix()
|
||||
: Matrix(1.0, -yx, xy, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
struct PaintSkew : public PaintTransformBase {
|
||||
|
|
|
@ -4485,7 +4485,7 @@ gfxFontStyle::gfxFontStyle(FontSlantStyle aStyle, FontWeight aWeight,
|
|||
allowSyntheticStyle(aAllowStyleSynthesis),
|
||||
allowSyntheticSmallCaps(aAllowSmallCapsSynthesis),
|
||||
noFallbackVariantFeatures(true) {
|
||||
MOZ_ASSERT(!mozilla::IsNaN(size));
|
||||
MOZ_ASSERT(!std::isnan(size));
|
||||
|
||||
switch (aSizeAdjust.tag) {
|
||||
case FontSizeAdjust::Tag::None:
|
||||
|
@ -4507,7 +4507,7 @@ gfxFontStyle::gfxFontStyle(FontSlantStyle aStyle, FontWeight aWeight,
|
|||
sizeAdjust = aSizeAdjust.AsIcHeight();
|
||||
break;
|
||||
}
|
||||
MOZ_ASSERT(!mozilla::IsNaN(sizeAdjust));
|
||||
MOZ_ASSERT(!std::isnan(sizeAdjust));
|
||||
|
||||
sizeAdjustBasis = uint8_t(aSizeAdjust.tag);
|
||||
// sizeAdjustBasis is currently a small bitfield, so let's assert that the
|
||||
|
|
|
@ -53,7 +53,7 @@ Result<std::u16string_view, ICUError> NumberFormat::formatToParts(
|
|||
return Err(ICUError::InternalError);
|
||||
}
|
||||
|
||||
bool isNegative = !IsNaN(number) && IsNegative(number);
|
||||
bool isNegative = !std::isnan(number) && IsNegative(number);
|
||||
|
||||
return FormatResultToParts(mFormattedNumber, Some(number), isNegative,
|
||||
mFormatForUnit, parts);
|
||||
|
@ -110,7 +110,7 @@ bool NumberFormat::formatInternal(double number) const {
|
|||
// ICU incorrectly formats NaN values with the sign bit set, as if they
|
||||
// were negative. Replace all NaNs with a single pattern with sign bit
|
||||
// unset ("positive", that is) until ICU is fixed.
|
||||
if (MOZ_UNLIKELY(IsNaN(number))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(number))) {
|
||||
number = SpecificNaN<double>(0, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ Maybe<NumberPartType> GetPartTypeForNumberField(UNumberFormatFields fieldName,
|
|||
switch (fieldName) {
|
||||
case UNUM_INTEGER_FIELD:
|
||||
if (number.isSome()) {
|
||||
if (IsNaN(*number)) {
|
||||
if (std::isnan(*number)) {
|
||||
return Some(NumberPartType::Nan);
|
||||
}
|
||||
if (!IsFinite(*number)) {
|
||||
|
|
|
@ -73,10 +73,10 @@ bool NumberRangeFormat::formatInternal(double start, double end) const {
|
|||
// ICU incorrectly formats NaN values with the sign bit set, as if they
|
||||
// were negative. Replace all NaNs with a single pattern with sign bit
|
||||
// unset ("positive", that is) until ICU is fixed.
|
||||
if (MOZ_UNLIKELY(IsNaN(start))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(start))) {
|
||||
start = SpecificNaN<double>(0, 1);
|
||||
}
|
||||
if (MOZ_UNLIKELY(IsNaN(end))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(end))) {
|
||||
end = SpecificNaN<double>(0, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,8 +130,8 @@ class NumberRangeFormat final {
|
|||
return Err(ICUError::InternalError);
|
||||
}
|
||||
|
||||
bool isNegativeStart = !IsNaN(start) && IsNegative(start);
|
||||
bool isNegativeEnd = !IsNaN(end) && IsNegative(end);
|
||||
bool isNegativeStart = !std::isnan(start) && IsNegative(start);
|
||||
bool isNegativeEnd = !std::isnan(end) && IsNegative(end);
|
||||
|
||||
return formatResultToParts(Some(start), isNegativeStart, Some(end),
|
||||
isNegativeEnd, parts);
|
||||
|
|
|
@ -139,7 +139,7 @@ Result<Span<const char16_t>, ICUError> RelativeTimeFormat::formatToParts(
|
|||
return Err(ToICUError(status));
|
||||
}
|
||||
|
||||
bool isNegative = !IsNaN(aNumber) && IsNegative(aNumber);
|
||||
bool isNegative = !std::isnan(aNumber) && IsNegative(aNumber);
|
||||
|
||||
// Necessary until all of intl is using Span (Bug 1709880)
|
||||
return FormatResultToParts(formattedValue, Nothing(), isNegative,
|
||||
|
|
|
@ -118,7 +118,7 @@ MOZ_ALWAYS_INLINE bool ToBoolean(HandleValue v) {
|
|||
}
|
||||
if (v.isDouble()) {
|
||||
double d = v.toDouble();
|
||||
return !mozilla::IsNaN(d) && d != 0;
|
||||
return !std::isnan(d) && d != 0;
|
||||
}
|
||||
if (v.isSymbol()) {
|
||||
return true;
|
||||
|
@ -149,7 +149,7 @@ inline double ToInteger(double d) {
|
|||
}
|
||||
|
||||
if (!mozilla::IsFinite(d)) {
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
return 0;
|
||||
}
|
||||
return d;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* of accessor methods to the various aspects of the represented date.
|
||||
*/
|
||||
|
||||
#include "mozilla/FloatingPoint.h" // mozilla::{IsFinite,IsNaN}, mozilla::UnspecifiedNaN
|
||||
#include "mozilla/FloatingPoint.h" // mozilla::{IsFinite,}, mozilla::UnspecifiedNaN
|
||||
#include "mozilla/MathAlgorithms.h" // mozilla::Abs
|
||||
|
||||
#include "js/Conversions.h" // JS::ToInteger
|
||||
|
@ -90,7 +90,7 @@ class ClippedTime {
|
|||
|
||||
double toDouble() const { return t; }
|
||||
|
||||
bool isValid() const { return !mozilla::IsNaN(t); }
|
||||
bool isValid() const { return !std::isnan(t); }
|
||||
};
|
||||
|
||||
// ES6 20.3.1.15.
|
||||
|
|
|
@ -466,7 +466,7 @@ static MOZ_ALWAYS_INLINE double GenericNaN() {
|
|||
// Convert an arbitrary double to one compatible with JS::Value representation
|
||||
// by replacing any NaN value with a canonical one.
|
||||
static MOZ_ALWAYS_INLINE double CanonicalizeNaN(double d) {
|
||||
if (MOZ_UNLIKELY(mozilla::IsNaN(d))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(d))) {
|
||||
return GenericNaN();
|
||||
}
|
||||
return d;
|
||||
|
|
|
@ -4117,9 +4117,9 @@ static bool SearchElementDense(JSContext* cx, HandleValue val, Iter iterator,
|
|||
double dval = val.toNumber();
|
||||
// For |includes|, two NaN values are considered equal, so we use a
|
||||
// different implementation for NaN.
|
||||
if (Kind == SearchKind::Includes && mozilla::IsNaN(dval)) {
|
||||
if (Kind == SearchKind::Includes && std::isnan(dval)) {
|
||||
auto cmp = [](JSContext*, const Value& element, bool* equal) {
|
||||
*equal = (element.isDouble() && mozilla::IsNaN(element.toDouble()));
|
||||
*equal = (element.isDouble() && std::isnan(element.toDouble()));
|
||||
return true;
|
||||
};
|
||||
return iterator(cx, cmp, rval);
|
||||
|
|
|
@ -633,7 +633,7 @@ static bool DoAtomicsWait(JSContext* cx,
|
|||
}
|
||||
|
||||
// Step 7.
|
||||
if (!mozilla::IsNaN(timeout_ms)) {
|
||||
if (!std::isnan(timeout_ms)) {
|
||||
if (timeout_ms < 0) {
|
||||
timeout = mozilla::Some(mozilla::TimeDuration::FromSeconds(0.0));
|
||||
} else if (!mozilla::IsInfinite(timeout_ms)) {
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
using namespace js;
|
||||
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::NumberEqualsInt32;
|
||||
|
||||
/*** HashableValue **********************************************************/
|
||||
|
|
|
@ -67,7 +67,6 @@ using JS::SymbolCode;
|
|||
using mozilla::AsciiAlphanumericToNumber;
|
||||
using mozilla::CheckedInt;
|
||||
using mozilla::IsAsciiHexDigit;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::PodCopy;
|
||||
using mozilla::RangedPtr;
|
||||
using mozilla::SIMD;
|
||||
|
@ -2250,7 +2249,7 @@ static bool str_lastIndexOf(JSContext* cx, unsigned argc, Value* vp) {
|
|||
if (!ToNumber(cx, args[1], &d)) {
|
||||
return false;
|
||||
}
|
||||
if (!IsNaN(d)) {
|
||||
if (!std::isnan(d)) {
|
||||
d = JS::ToInteger(d);
|
||||
if (d <= 0) {
|
||||
start = 0;
|
||||
|
|
|
@ -2814,7 +2814,7 @@ static bool SaveStack(JSContext* cx, unsigned argc, Value* vp) {
|
|||
if (!ToNumber(cx, args[0], &maxDouble)) {
|
||||
return false;
|
||||
}
|
||||
if (mozilla::IsNaN(maxDouble) || maxDouble < 0 || maxDouble > UINT32_MAX) {
|
||||
if (std::isnan(maxDouble) || maxDouble < 0 || maxDouble > UINT32_MAX) {
|
||||
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0],
|
||||
nullptr, "not a valid maximum frame count");
|
||||
return false;
|
||||
|
|
|
@ -1021,7 +1021,7 @@ static bool ToIntlMathematicalValue(JSContext* cx, MutableHandleValue value) {
|
|||
double number = LinearStringToNumber(str);
|
||||
|
||||
bool exponentTooLarge = false;
|
||||
if (mozilla::IsNaN(number)) {
|
||||
if (std::isnan(number)) {
|
||||
// Set to NaN if the input can't be parsed as a number.
|
||||
value.setNaN();
|
||||
} else if (IsNonDecimalNumber(str)) {
|
||||
|
@ -1269,13 +1269,13 @@ bool js::intl_FormatNumberRange(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
// PartitionNumberRangePattern, step 1.
|
||||
if (start.isDouble() && mozilla::IsNaN(start.toDouble())) {
|
||||
if (start.isDouble() && std::isnan(start.toDouble())) {
|
||||
JS_ReportErrorNumberASCII(
|
||||
cx, GetErrorMessage, nullptr, JSMSG_NAN_NUMBER_RANGE, "start",
|
||||
"NumberFormat", formatToParts ? "formatRangeToParts" : "formatRange");
|
||||
return false;
|
||||
}
|
||||
if (end.isDouble() && mozilla::IsNaN(end.toDouble())) {
|
||||
if (end.isDouble() && std::isnan(end.toDouble())) {
|
||||
JS_ReportErrorNumberASCII(
|
||||
cx, GetErrorMessage, nullptr, JSMSG_NAN_NUMBER_RANGE, "end",
|
||||
"NumberFormat", formatToParts ? "formatRangeToParts" : "formatRange");
|
||||
|
|
|
@ -350,13 +350,13 @@ bool js::intl_SelectPluralRuleRange(JSContext* cx, unsigned argc, Value* vp) {
|
|||
double y = args[2].toNumber();
|
||||
|
||||
// Step 5.
|
||||
if (mozilla::IsNaN(x)) {
|
||||
if (std::isnan(x)) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_NAN_NUMBER_RANGE, "start", "PluralRules",
|
||||
"selectRange");
|
||||
return false;
|
||||
}
|
||||
if (mozilla::IsNaN(y)) {
|
||||
if (std::isnan(y)) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_NAN_NUMBER_RANGE, "end", "PluralRules",
|
||||
"selectRange");
|
||||
|
|
|
@ -27,7 +27,6 @@ using namespace js::frontend;
|
|||
using JS::GenericNaN;
|
||||
using JS::ToInt32;
|
||||
using JS::ToUint32;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::IsNegative;
|
||||
using mozilla::NegativeInfinity;
|
||||
using mozilla::PositiveInfinity;
|
||||
|
@ -529,7 +528,7 @@ static Truthiness Boolish(ParseNode* pn) {
|
|||
switch (pn->getKind()) {
|
||||
case ParseNodeKind::NumberExpr:
|
||||
return (pn->as<NumericLiteral>().value() != 0 &&
|
||||
!IsNaN(pn->as<NumericLiteral>().value()))
|
||||
!std::isnan(pn->as<NumericLiteral>().value()))
|
||||
? Truthy
|
||||
: Falsy;
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ using JS::ToInt32;
|
|||
using mozilla::CheckedInt;
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::IsFloat32Representable;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::IsPowerOfTwo;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::NumbersAreIdentical;
|
||||
|
@ -975,7 +974,7 @@ MConstant* MConstant::New(TempAllocator::Fallible alloc, const Value& v) {
|
|||
}
|
||||
|
||||
MConstant* MConstant::NewFloat32(TempAllocator& alloc, double d) {
|
||||
MOZ_ASSERT(IsNaN(d) || d == double(float(d)));
|
||||
MOZ_ASSERT(std::isnan(d) || d == double(float(d)));
|
||||
return new (alloc) MConstant(float(d));
|
||||
}
|
||||
|
||||
|
@ -1328,10 +1327,10 @@ bool MConstant::valueToBoolean(bool* res) const {
|
|||
*res = toInt64() != 0;
|
||||
return true;
|
||||
case MIRType::Double:
|
||||
*res = !mozilla::IsNaN(toDouble()) && toDouble() != 0.0;
|
||||
*res = !std::isnan(toDouble()) && toDouble() != 0.0;
|
||||
return true;
|
||||
case MIRType::Float32:
|
||||
*res = !mozilla::IsNaN(toFloat32()) && toFloat32() != 0.0f;
|
||||
*res = !std::isnan(toFloat32()) && toFloat32() != 0.0f;
|
||||
return true;
|
||||
case MIRType::Null:
|
||||
case MIRType::Undefined:
|
||||
|
@ -3785,7 +3784,7 @@ MDefinition* MWasmTruncateToInt32::foldsTo(TempAllocator& alloc) {
|
|||
|
||||
if (input->type() == MIRType::Double && input->isConstant()) {
|
||||
double d = input->toConstant()->toDouble();
|
||||
if (IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -3800,7 +3799,7 @@ MDefinition* MWasmTruncateToInt32::foldsTo(TempAllocator& alloc) {
|
|||
|
||||
if (input->type() == MIRType::Float32 && input->isConstant()) {
|
||||
double f = double(input->toConstant()->toFloat32());
|
||||
if (IsNaN(f)) {
|
||||
if (std::isnan(f)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -4269,7 +4268,7 @@ bool MCompare::evaluateConstantOperands(TempAllocator& alloc, bool* result) {
|
|||
}
|
||||
|
||||
// Optimize comparison against NaN.
|
||||
if (mozilla::IsNaN(cte)) {
|
||||
if (std::isnan(cte)) {
|
||||
switch (jsop_) {
|
||||
case JSOp::Lt:
|
||||
case JSOp::Le:
|
||||
|
|
|
@ -37,7 +37,6 @@ using mozilla::CountLeadingZeroes32;
|
|||
using mozilla::ExponentComponent;
|
||||
using mozilla::FloorLog2;
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::IsNegativeZero;
|
||||
using mozilla::NegativeInfinity;
|
||||
using mozilla::NumberEqualsInt32;
|
||||
|
@ -676,7 +675,7 @@ Range::Range(const MDefinition* def)
|
|||
|
||||
static uint16_t ExponentImpliedByDouble(double d) {
|
||||
// Handle the special values.
|
||||
if (IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
return Range::IncludesInfinityAndNaN;
|
||||
}
|
||||
if (IsInfinite(d)) {
|
||||
|
@ -726,8 +725,8 @@ void Range::setDouble(double l, double h) {
|
|||
// won't have a fractional value if the value is always beyond the point at
|
||||
// which double precision can't represent fractional values.
|
||||
uint16_t minExp = std::min(lExp, hExp);
|
||||
bool includesNegative = IsNaN(l) || l < 0;
|
||||
bool includesPositive = IsNaN(h) || h > 0;
|
||||
bool includesNegative = std::isnan(l) || l < 0;
|
||||
bool includesPositive = std::isnan(h) || h > 0;
|
||||
bool crossesZero = includesNegative && includesPositive;
|
||||
if (crossesZero || minExp < MaxTruncatableExponent) {
|
||||
canHaveFractionalPart_ = IncludesFractionalParts;
|
||||
|
|
|
@ -439,7 +439,7 @@ class Range : public TempObject {
|
|||
// function treats negative zero as equal to zero, as >= and <= do. If the
|
||||
// range includes zero, it is assumed to include negative zero too.
|
||||
static Range* NewDoubleRange(TempAllocator& alloc, double l, double h) {
|
||||
if (mozilla::IsNaN(l) && mozilla::IsNaN(h)) {
|
||||
if (std::isnan(l) && std::isnan(h)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ class Range : public TempObject {
|
|||
// makes the strictest possible range containin zero a range which
|
||||
// contains one value rather than two.
|
||||
static Range* NewDoubleSingletonRange(TempAllocator& alloc, double d) {
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1405,7 +1405,7 @@ RNaNToZero::RNaNToZero(CompactBufferReader& reader) {}
|
|||
|
||||
bool RNaNToZero::recover(JSContext* cx, SnapshotIterator& iter) const {
|
||||
double v = iter.read().toNumber();
|
||||
if (mozilla::IsNaN(v) || mozilla::IsNegativeZero(v)) {
|
||||
if (std::isnan(v) || mozilla::IsNegativeZero(v)) {
|
||||
v = 0.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1995,7 +1995,7 @@ bool Simulator::overflowFrom(int32_t alu_out, int32_t left, int32_t right,
|
|||
|
||||
// Support for VFP comparisons.
|
||||
void Simulator::compute_FPSCR_Flags(double val1, double val2) {
|
||||
if (mozilla::IsNaN(val1) || mozilla::IsNaN(val2)) {
|
||||
if (std::isnan(val1) || std::isnan(val2)) {
|
||||
n_flag_FPSCR_ = false;
|
||||
z_flag_FPSCR_ = false;
|
||||
c_flag_FPSCR_ = true;
|
||||
|
@ -4567,7 +4567,7 @@ void Simulator::decodeVCMP(SimInstruction* instr) {
|
|||
|
||||
// Raise exceptions for quiet NaNs if necessary.
|
||||
if (instr->bit(7) == 1) {
|
||||
if (mozilla::IsNaN(dd_value)) {
|
||||
if (std::isnan(dd_value)) {
|
||||
inv_op_vfp_flag_ = true;
|
||||
}
|
||||
}
|
||||
|
@ -4582,7 +4582,7 @@ void Simulator::decodeVCMP(SimInstruction* instr) {
|
|||
|
||||
// Raise exceptions for quiet NaNs if necessary.
|
||||
if (instr->bit(7) == 1) {
|
||||
if (mozilla::IsNaN(fd_value)) {
|
||||
if (std::isnan(fd_value)) {
|
||||
inv_op_vfp_flag_ = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2593,32 +2593,31 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
setFpuRegisterFloat(fd_reg, sqrtf(fs_value));
|
||||
break;
|
||||
case ff_c_un_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
mozilla::IsNaN(fs_value) || mozilla::IsNaN(ft_value));
|
||||
setFCSRBit(fcsr_cc, std::isnan(fs_value) || std::isnan(ft_value));
|
||||
break;
|
||||
case ff_c_eq_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value == ft_value));
|
||||
break;
|
||||
case ff_c_ueq_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value == ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value == ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_c_olt_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value < ft_value));
|
||||
break;
|
||||
case ff_c_ult_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value < ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value < ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_c_ole_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value <= ft_value));
|
||||
break;
|
||||
case ff_c_ule_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value <= ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value <= ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_cvt_d_fmt:
|
||||
f = getFpuRegisterFloat(fs_reg);
|
||||
|
@ -2741,8 +2740,7 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
break;
|
||||
case ff_c_un_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
setFCSRBit(fcsr_cc,
|
||||
mozilla::IsNaN(ds_value) || mozilla::IsNaN(dt_value));
|
||||
setFCSRBit(fcsr_cc, std::isnan(ds_value) || std::isnan(dt_value));
|
||||
break;
|
||||
case ff_c_eq_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
|
@ -2751,8 +2749,8 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
case ff_c_ueq_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value == dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value == dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_c_olt_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
|
@ -2761,8 +2759,8 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
case ff_c_ult_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value < dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value < dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_c_ole_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
|
@ -2771,8 +2769,8 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
case ff_c_ule_fmt:
|
||||
dt_value = getFpuRegisterDouble(ft_reg);
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value <= dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value <= dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_cvt_w_fmt: // Convert double to word.
|
||||
// Rounding modes are not yet supported.
|
||||
|
|
|
@ -3218,32 +3218,31 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
setFpuRegisterFloat(fd_reg, sqrtf(fs_value));
|
||||
break;
|
||||
case ff_c_un_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
mozilla::IsNaN(fs_value) || mozilla::IsNaN(ft_value));
|
||||
setFCSRBit(fcsr_cc, std::isnan(fs_value) || std::isnan(ft_value));
|
||||
break;
|
||||
case ff_c_eq_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value == ft_value));
|
||||
break;
|
||||
case ff_c_ueq_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value == ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value == ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_c_olt_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value < ft_value));
|
||||
break;
|
||||
case ff_c_ult_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value < ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value < ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_c_ole_fmt:
|
||||
setFCSRBit(fcsr_cc, (fs_value <= ft_value));
|
||||
break;
|
||||
case ff_c_ule_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(fs_value <= ft_value) || (mozilla::IsNaN(fs_value) ||
|
||||
mozilla::IsNaN(ft_value)));
|
||||
(fs_value <= ft_value) ||
|
||||
(std::isnan(fs_value) || std::isnan(ft_value)));
|
||||
break;
|
||||
case ff_cvt_d_fmt:
|
||||
f = getFpuRegisterFloat(fs_reg);
|
||||
|
@ -3395,32 +3394,31 @@ void Simulator::decodeTypeRegister(SimInstruction* instr) {
|
|||
setFpuRegisterDouble(fd_reg, sqrt(ds_value));
|
||||
break;
|
||||
case ff_c_un_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
mozilla::IsNaN(ds_value) || mozilla::IsNaN(dt_value));
|
||||
setFCSRBit(fcsr_cc, std::isnan(ds_value) || std::isnan(dt_value));
|
||||
break;
|
||||
case ff_c_eq_fmt:
|
||||
setFCSRBit(fcsr_cc, (ds_value == dt_value));
|
||||
break;
|
||||
case ff_c_ueq_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value == dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value == dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_c_olt_fmt:
|
||||
setFCSRBit(fcsr_cc, (ds_value < dt_value));
|
||||
break;
|
||||
case ff_c_ult_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value < dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value < dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_c_ole_fmt:
|
||||
setFCSRBit(fcsr_cc, (ds_value <= dt_value));
|
||||
break;
|
||||
case ff_c_ule_fmt:
|
||||
setFCSRBit(fcsr_cc,
|
||||
(ds_value <= dt_value) || (mozilla::IsNaN(ds_value) ||
|
||||
mozilla::IsNaN(dt_value)));
|
||||
(ds_value <= dt_value) ||
|
||||
(std::isnan(ds_value) || std::isnan(dt_value)));
|
||||
break;
|
||||
case ff_cvt_w_fmt: // Convert double to word.
|
||||
// Rounding modes are not yet supported.
|
||||
|
|
|
@ -66,7 +66,6 @@ using mozilla::IsAsciiAlpha;
|
|||
using mozilla::IsAsciiDigit;
|
||||
using mozilla::IsAsciiLowercaseAlpha;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::NumbersAreIdentical;
|
||||
using mozilla::Relaxed;
|
||||
|
||||
|
@ -714,7 +713,7 @@ static bool date_UTC(JSContext* cx, unsigned argc, Value* vp) {
|
|||
|
||||
// Step 8.
|
||||
double yr = y;
|
||||
if (!IsNaN(y)) {
|
||||
if (!std::isnan(y)) {
|
||||
double yint = ToInteger(y);
|
||||
if (0 <= yint && yint <= 99) {
|
||||
yr = 1900 + yint;
|
||||
|
@ -1920,7 +1919,7 @@ static bool date_getHours(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// int32 or NaN after the call to fillLocalTimeSlots.
|
||||
Value yearSeconds = unwrapped->localSecondsIntoYear();
|
||||
if (yearSeconds.isDouble()) {
|
||||
MOZ_ASSERT(IsNaN(yearSeconds.toDouble()));
|
||||
MOZ_ASSERT(std::isnan(yearSeconds.toDouble()));
|
||||
args.rval().set(yearSeconds);
|
||||
} else {
|
||||
args.rval().setInt32((yearSeconds.toInt32() / int(SecondsPerHour)) %
|
||||
|
@ -1960,7 +1959,7 @@ static bool date_getMinutes(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// int32 or NaN after the call to fillLocalTimeSlots.
|
||||
Value yearSeconds = unwrapped->localSecondsIntoYear();
|
||||
if (yearSeconds.isDouble()) {
|
||||
MOZ_ASSERT(IsNaN(yearSeconds.toDouble()));
|
||||
MOZ_ASSERT(std::isnan(yearSeconds.toDouble()));
|
||||
args.rval().set(yearSeconds);
|
||||
} else {
|
||||
args.rval().setInt32((yearSeconds.toInt32() / int(SecondsPerMinute)) %
|
||||
|
@ -2001,7 +2000,7 @@ static bool date_getSeconds(JSContext* cx, unsigned argc, Value* vp) {
|
|||
// int32 or NaN after the call to fillLocalTimeSlots.
|
||||
Value yearSeconds = unwrapped->localSecondsIntoYear();
|
||||
if (yearSeconds.isDouble()) {
|
||||
MOZ_ASSERT(IsNaN(yearSeconds.toDouble()));
|
||||
MOZ_ASSERT(std::isnan(yearSeconds.toDouble()));
|
||||
args.rval().set(yearSeconds);
|
||||
} else {
|
||||
args.rval().setInt32(yearSeconds.toInt32() % int(SecondsPerMinute));
|
||||
|
@ -2606,7 +2605,7 @@ static bool date_setUTCMonth(JSContext* cx, unsigned argc, Value* vp) {
|
|||
static double ThisLocalTimeOrZero(DateTimeInfo::ShouldRFP shouldRFP,
|
||||
Handle<DateObject*> dateObj) {
|
||||
double t = dateObj->UTCTime().toNumber();
|
||||
if (IsNaN(t)) {
|
||||
if (std::isnan(t)) {
|
||||
return +0;
|
||||
}
|
||||
return LocalTime(shouldRFP, t);
|
||||
|
@ -2614,7 +2613,7 @@ static double ThisLocalTimeOrZero(DateTimeInfo::ShouldRFP shouldRFP,
|
|||
|
||||
static double ThisUTCTimeOrZero(Handle<DateObject*> dateObj) {
|
||||
double t = dateObj->as<DateObject>().UTCTime().toNumber();
|
||||
return IsNaN(t) ? +0 : t;
|
||||
return std::isnan(t) ? +0 : t;
|
||||
}
|
||||
|
||||
/* ES5 15.9.5.40. */
|
||||
|
@ -2721,7 +2720,7 @@ static bool date_setYear(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
/* Step 3. */
|
||||
if (IsNaN(y)) {
|
||||
if (std::isnan(y)) {
|
||||
unwrapped->setUTCTime(ClippedTime::invalid(), args.rval());
|
||||
return true;
|
||||
}
|
||||
|
@ -3498,7 +3497,7 @@ static bool DateMultipleArguments(JSContext* cx, const CallArgs& args) {
|
|||
|
||||
// Step 3o.
|
||||
double yr = y;
|
||||
if (!IsNaN(y)) {
|
||||
if (!std::isnan(y)) {
|
||||
double yint = ToInteger(y);
|
||||
if (0 <= yint && yint <= 99) {
|
||||
yr = 1900 + yint;
|
||||
|
@ -3607,7 +3606,7 @@ JS_PUBLIC_API bool js::DateIsValid(JSContext* cx, HandleObject obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
*isValid = !IsNaN(unboxed.toNumber());
|
||||
*isValid = !std::isnan(unboxed.toNumber());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace js {
|
|||
inline double NumberDiv(double a, double b) {
|
||||
AutoUnsafeCallWithABI unsafe;
|
||||
if (b == 0) {
|
||||
if (a == 0 || mozilla::IsNaN(a)) {
|
||||
if (a == 0 || std::isnan(a)) {
|
||||
return JS::GenericNaN();
|
||||
}
|
||||
if (mozilla::IsNegative(a) != mozilla::IsNegative(b)) {
|
||||
|
|
|
@ -41,7 +41,6 @@ using mozilla::ExponentComponent;
|
|||
using mozilla::FloatingPoint;
|
||||
using mozilla::IsFinite;
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::IsNegative;
|
||||
using mozilla::IsNegativeZero;
|
||||
using mozilla::Maybe;
|
||||
|
@ -318,7 +317,7 @@ double js::math_max_impl(double x, double y) {
|
|||
AutoUnsafeCallWithABI unsafe;
|
||||
|
||||
// Math.max(num, NaN) => NaN, Math.max(-0, +0) => +0
|
||||
if (x > y || IsNaN(x) || (x == y && IsNegative(y))) {
|
||||
if (x > y || std::isnan(x) || (x == y && IsNegative(y))) {
|
||||
return x;
|
||||
}
|
||||
return y;
|
||||
|
@ -343,7 +342,7 @@ double js::math_min_impl(double x, double y) {
|
|||
AutoUnsafeCallWithABI unsafe;
|
||||
|
||||
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
|
||||
if (x < y || IsNaN(x) || (x == y && IsNegativeZero(x))) {
|
||||
if (x < y || std::isnan(x) || (x == y && IsNegativeZero(x))) {
|
||||
return x;
|
||||
}
|
||||
return y;
|
||||
|
@ -770,8 +769,7 @@ double js::hypot4(double x, double y, double z, double w) {
|
|||
return mozilla::PositiveInfinity<double>();
|
||||
}
|
||||
|
||||
if (mozilla::IsNaN(x) || mozilla::IsNaN(y) || mozilla::IsNaN(z) ||
|
||||
mozilla::IsNaN(w)) {
|
||||
if (std::isnan(x) || std::isnan(y) || std::isnan(z) || std::isnan(w)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
@ -827,7 +825,7 @@ bool js::math_hypot_handle(JSContext* cx, HandleValueArray args,
|
|||
}
|
||||
|
||||
isInfinite |= mozilla::IsInfinite(x);
|
||||
isNaN |= mozilla::IsNaN(x);
|
||||
isNaN |= std::isnan(x);
|
||||
if (isInfinite || isNaN) {
|
||||
continue;
|
||||
}
|
||||
|
@ -871,7 +869,7 @@ bool js::math_trunc(JSContext* cx, unsigned argc, Value* vp) {
|
|||
double js::math_sign_impl(double x) {
|
||||
AutoUnsafeCallWithABI unsafe;
|
||||
|
||||
if (mozilla::IsNaN(x)) {
|
||||
if (std::isnan(x)) {
|
||||
return GenericNaN();
|
||||
}
|
||||
|
||||
|
|
|
@ -1233,7 +1233,7 @@ static bool num_toFixed(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
// Step 6.
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
args.rval().setString(cx->names().NaN);
|
||||
return true;
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ static bool num_toExponential(JSContext* cx, unsigned argc, Value* vp) {
|
|||
MOZ_ASSERT_IF(!args.hasDefined(0), prec == 0);
|
||||
|
||||
// Step 4.
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
args.rval().setString(cx->names().NaN);
|
||||
return true;
|
||||
}
|
||||
|
@ -1368,7 +1368,7 @@ static bool num_toPrecision(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
// Step 4.
|
||||
if (mozilla::IsNaN(d)) {
|
||||
if (std::isnan(d)) {
|
||||
args.rval().setString(cx->names().NaN);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4361,7 +4361,7 @@ static bool Sleep_fn(JSContext* cx, unsigned argc, Value* vp) {
|
|||
if (!ToNumber(cx, args[0], &t_secs)) {
|
||||
return false;
|
||||
}
|
||||
if (mozilla::IsNaN(t_secs)) {
|
||||
if (std::isnan(t_secs)) {
|
||||
JS_ReportErrorASCII(cx, "sleep interval is not a number");
|
||||
return false;
|
||||
}
|
||||
|
@ -4519,7 +4519,7 @@ static void CancelExecution(JSContext* cx) {
|
|||
}
|
||||
|
||||
static bool SetTimeoutValue(JSContext* cx, double t) {
|
||||
if (mozilla::IsNaN(t)) {
|
||||
if (std::isnan(t)) {
|
||||
JS_ReportErrorASCII(cx, "timeout is not a number");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3275,7 +3275,7 @@ bool BigInt::equal(BigInt* lhs, BigInt* rhs) {
|
|||
}
|
||||
|
||||
int8_t BigInt::compare(BigInt* x, double y) {
|
||||
MOZ_ASSERT(!mozilla::IsNaN(y));
|
||||
MOZ_ASSERT(!std::isnan(y));
|
||||
|
||||
constexpr int LessThan = -1, Equal = 0, GreaterThan = 1;
|
||||
|
||||
|
@ -3406,7 +3406,7 @@ int8_t BigInt::compare(BigInt* x, double y) {
|
|||
}
|
||||
|
||||
bool BigInt::equal(BigInt* lhs, double rhs) {
|
||||
if (mozilla::IsNaN(rhs)) {
|
||||
if (std::isnan(rhs)) {
|
||||
return false;
|
||||
}
|
||||
return compare(lhs, rhs) == 0;
|
||||
|
@ -3462,14 +3462,14 @@ JS::Result<bool> BigInt::looselyEqual(JSContext* cx, HandleBigInt lhs,
|
|||
bool BigInt::lessThan(BigInt* x, BigInt* y) { return compare(x, y) < 0; }
|
||||
|
||||
Maybe<bool> BigInt::lessThan(BigInt* lhs, double rhs) {
|
||||
if (mozilla::IsNaN(rhs)) {
|
||||
if (std::isnan(rhs)) {
|
||||
return Maybe<bool>(Nothing());
|
||||
}
|
||||
return Some(compare(lhs, rhs) < 0);
|
||||
}
|
||||
|
||||
Maybe<bool> BigInt::lessThan(double lhs, BigInt* rhs) {
|
||||
if (mozilla::IsNaN(lhs)) {
|
||||
if (std::isnan(lhs)) {
|
||||
return Maybe<bool>(Nothing());
|
||||
}
|
||||
return Some(-compare(rhs, lhs) < 0);
|
||||
|
|
|
@ -254,7 +254,7 @@ static inline bool IsNegativeZero(const JS::Value& v) {
|
|||
}
|
||||
|
||||
static inline bool IsNaN(const JS::Value& v) {
|
||||
return v.isDouble() && mozilla::IsNaN(v.toDouble());
|
||||
return v.isDouble() && std::isnan(v.toDouble());
|
||||
}
|
||||
|
||||
bool js::SameValue(JSContext* cx, JS::Handle<JS::Value> v1,
|
||||
|
|
|
@ -1740,7 +1740,7 @@ static MOZ_ALWAYS_INLINE bool LessThanImpl(JSContext* cx,
|
|||
double lhsNum = lhs.toNumber();
|
||||
double rhsNum = rhs.toNumber();
|
||||
|
||||
if (mozilla::IsNaN(lhsNum) || mozilla::IsNaN(rhsNum)) {
|
||||
if (std::isnan(lhsNum) || std::isnan(rhsNum)) {
|
||||
res = mozilla::Maybe<bool>(mozilla::Nothing());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -740,7 +740,7 @@ class ElementSpecific {
|
|||
}
|
||||
return T(d);
|
||||
}
|
||||
if (MOZ_UNLIKELY(mozilla::IsNaN(d))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(d))) {
|
||||
return T(0);
|
||||
}
|
||||
if (TypeIDOfType<T>::id == Scalar::Uint8Clamped) {
|
||||
|
|
|
@ -90,7 +90,6 @@ using mozilla::Abs;
|
|||
using mozilla::AsVariant;
|
||||
using mozilla::CeilingLog2;
|
||||
using mozilla::HashGeneric;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::IsNegativeZero;
|
||||
using mozilla::IsPositiveZero;
|
||||
using mozilla::IsPowerOfTwo;
|
||||
|
@ -2335,7 +2334,7 @@ static NumLit ExtractNumericLiteral(ModuleValidatorShared& m, ParseNode* pn) {
|
|||
|
||||
// The syntactic checks above rule out these double values.
|
||||
MOZ_ASSERT(!IsNegativeZero(d));
|
||||
MOZ_ASSERT(!IsNaN(d));
|
||||
MOZ_ASSERT(!std::isnan(d));
|
||||
|
||||
// Although doubles can only *precisely* represent 53-bit integers, they
|
||||
// can *imprecisely* represent integers much bigger than an int64_t.
|
||||
|
@ -6767,8 +6766,8 @@ static bool ValidateConstant(JSContext* cx, const AsmJSGlobal& global,
|
|||
}
|
||||
|
||||
// NaN != NaN
|
||||
if (IsNaN(global.constantValue())) {
|
||||
if (!IsNaN(v.toNumber())) {
|
||||
if (std::isnan(global.constantValue())) {
|
||||
if (!std::isnan(v.toNumber())) {
|
||||
return LinkFail(cx, "global constant value needs to be NaN");
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -54,7 +54,6 @@ using namespace jit;
|
|||
using namespace wasm;
|
||||
|
||||
using mozilla::HashGeneric;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::MakeEnumeratedRange;
|
||||
|
||||
static const unsigned BUILTIN_THUNK_LIFO_SIZE = 64 * 1024;
|
||||
|
@ -934,7 +933,8 @@ static int64_t UModI64(uint32_t x_hi, uint32_t x_lo, uint32_t y_hi,
|
|||
static int64_t TruncateDoubleToInt64(double input) {
|
||||
// Note: INT64_MAX is not representable in double. It is actually
|
||||
// INT64_MAX + 1. Therefore also sending the failure value.
|
||||
if (input >= double(INT64_MAX) || input < double(INT64_MIN) || IsNaN(input)) {
|
||||
if (input >= double(INT64_MAX) || input < double(INT64_MIN) ||
|
||||
std::isnan(input)) {
|
||||
return int64_t(0x8000000000000000);
|
||||
}
|
||||
return int64_t(input);
|
||||
|
@ -943,7 +943,7 @@ static int64_t TruncateDoubleToInt64(double input) {
|
|||
static uint64_t TruncateDoubleToUint64(double input) {
|
||||
// Note: UINT64_MAX is not representable in double. It is actually
|
||||
// UINT64_MAX + 1. Therefore also sending the failure value.
|
||||
if (input >= double(UINT64_MAX) || input <= -1.0 || IsNaN(input)) {
|
||||
if (input >= double(UINT64_MAX) || input <= -1.0 || std::isnan(input)) {
|
||||
return int64_t(0x8000000000000000);
|
||||
}
|
||||
return uint64_t(input);
|
||||
|
@ -955,7 +955,7 @@ static int64_t SaturatingTruncateDoubleToInt64(double input) {
|
|||
return int64_t(input);
|
||||
}
|
||||
// Handle NaN.
|
||||
if (IsNaN(input)) {
|
||||
if (std::isnan(input)) {
|
||||
return 0;
|
||||
}
|
||||
// Handle positive overflow.
|
||||
|
|
|
@ -204,7 +204,7 @@ void MobileViewportManager::SetInitialViewport() {
|
|||
CSSToScreenScale MobileViewportManager::ClampZoom(
|
||||
const CSSToScreenScale& aZoom, const nsViewportInfo& aViewportInfo) const {
|
||||
CSSToScreenScale zoom = aZoom;
|
||||
if (IsNaN(zoom.scale)) {
|
||||
if (std::isnan(zoom.scale)) {
|
||||
NS_ERROR("Don't pass NaN to ClampZoom; check caller for 0/0 division");
|
||||
zoom = CSSToScreenScale(1.0);
|
||||
}
|
||||
|
|
|
@ -4067,10 +4067,10 @@ already_AddRefed<nsFontMetrics> nsLayoutUtils::GetFontMetricsForComputedStyle(
|
|||
}
|
||||
|
||||
nsFont font = styleFont->mFont;
|
||||
MOZ_ASSERT(!IsNaN(float(font.size.ToCSSPixels())),
|
||||
MOZ_ASSERT(!std::isnan(float(font.size.ToCSSPixels())),
|
||||
"Style font should never be NaN");
|
||||
font.size.ScaleBy(aInflation);
|
||||
if (MOZ_UNLIKELY(IsNaN(float(font.size.ToCSSPixels())))) {
|
||||
if (MOZ_UNLIKELY(std::isnan(float(font.size.ToCSSPixels())))) {
|
||||
font.size = {0};
|
||||
}
|
||||
font.variantWidth = aVariantWidth;
|
||||
|
|
|
@ -170,7 +170,7 @@ inline TimingParams TimingParamsFromCSSParams(float aDuration, float aDelay,
|
|||
float aIterationCount,
|
||||
dom::PlaybackDirection aDirection,
|
||||
dom::FillMode aFillMode) {
|
||||
MOZ_ASSERT(aIterationCount >= 0.0 && !IsNaN(aIterationCount),
|
||||
MOZ_ASSERT(aIterationCount >= 0.0 && !std::isnan(aIterationCount),
|
||||
"aIterations should be nonnegative & finite, as ensured by "
|
||||
"CSSParser");
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) : mUnit(aUnit) {
|
|||
MOZ_ASSERT(eCSSUnit_Percent <= aUnit, "not a float value");
|
||||
if (eCSSUnit_Percent <= aUnit) {
|
||||
mValue.mFloat = aValue;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
MOZ_ASSERT(!std::isnan(mValue.mFloat));
|
||||
} else {
|
||||
mUnit = eCSSUnit_Null;
|
||||
mValue.mInt = 0;
|
||||
|
@ -56,7 +56,7 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) : mUnit(aUnit) {
|
|||
nsCSSValue::nsCSSValue(const nsCSSValue& aCopy) : mUnit(aCopy.mUnit) {
|
||||
if (eCSSUnit_Percent <= mUnit) {
|
||||
mValue.mFloat = aCopy.mValue.mFloat;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
MOZ_ASSERT(!std::isnan(mValue.mFloat));
|
||||
} else if (eCSSUnit_Integer <= mUnit && mUnit <= eCSSUnit_Enumerated) {
|
||||
mValue.mInt = aCopy.mValue.mInt;
|
||||
} else {
|
||||
|
@ -148,7 +148,7 @@ void nsCSSValue::SetPercentValue(float aValue) {
|
|||
Reset();
|
||||
mUnit = eCSSUnit_Percent;
|
||||
mValue.mFloat = aValue;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
MOZ_ASSERT(!std::isnan(mValue.mFloat));
|
||||
}
|
||||
|
||||
void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) {
|
||||
|
@ -157,6 +157,6 @@ void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) {
|
|||
if (IsFloatUnit(aUnit)) {
|
||||
mUnit = aUnit;
|
||||
mValue.mFloat = aValue;
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
MOZ_ASSERT(!std::isnan(mValue.mFloat));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ class nsCSSValue {
|
|||
|
||||
float GetFloatValue() const {
|
||||
MOZ_ASSERT(eCSSUnit_Number <= mUnit, "not a float value");
|
||||
MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat));
|
||||
MOZ_ASSERT(!std::isnan(mValue.mFloat));
|
||||
return mValue.mFloat;
|
||||
}
|
||||
|
||||
|
|
|
@ -3733,7 +3733,7 @@ template <>
|
|||
CSSCoord StyleCalcNode::ResolveToCSSPixels(CSSCoord aBasis) const {
|
||||
CSSCoord result =
|
||||
ResolveInternal(aBasis, [](CSSCoord aPercent) { return aPercent; });
|
||||
if (IsNaN(float(result))) {
|
||||
if (std::isnan(float(result))) {
|
||||
return 0.0f; // This matches style::values::normalize
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -198,7 +198,7 @@ static MOZ_ALWAYS_INLINE bool IsFinite(T aValue) {
|
|||
*/
|
||||
template <typename T>
|
||||
static MOZ_ALWAYS_INLINE bool IsNegative(T aValue) {
|
||||
MOZ_ASSERT(!IsNaN(aValue), "NaN does not have a sign");
|
||||
MOZ_ASSERT(!std::isnan(aValue), "NaN does not have a sign");
|
||||
|
||||
/* The sign bit is set if the double is negative. */
|
||||
typedef FloatingPoint<T> Traits;
|
||||
|
@ -335,7 +335,7 @@ static MOZ_ALWAYS_INLINE void SpecificNaN(
|
|||
BitwiseCast<T>(
|
||||
(signbit ? Traits::kSignBit : 0) | Traits::kExponentBits | significand,
|
||||
result);
|
||||
MOZ_ASSERT(IsNaN(*result));
|
||||
MOZ_ASSERT(std::isnan(*result));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -525,8 +525,8 @@ static MOZ_ALWAYS_INLINE T UnspecifiedNaN() {
|
|||
template <typename T>
|
||||
static inline bool NumbersAreIdentical(T aValue1, T aValue2) {
|
||||
using Bits = typename FloatingPoint<T>::Bits;
|
||||
if (IsNaN(aValue1)) {
|
||||
return IsNaN(aValue2);
|
||||
if (std::isnan(aValue1)) {
|
||||
return std::isnan(aValue2);
|
||||
}
|
||||
return BitwiseCast<Bits>(aValue1) == BitwiseCast<Bits>(aValue2);
|
||||
}
|
||||
|
@ -546,8 +546,8 @@ static inline bool NumbersAreBitwiseIdentical(T aValue1, T aValue2) {
|
|||
*/
|
||||
template <typename T>
|
||||
static inline bool EqualOrBothNaN(T aValue1, T aValue2) {
|
||||
if (IsNaN(aValue1)) {
|
||||
return IsNaN(aValue2);
|
||||
if (std::isnan(aValue1)) {
|
||||
return std::isnan(aValue2);
|
||||
}
|
||||
return aValue1 == aValue2;
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ static inline bool EqualOrBothNaN(T aValue1, T aValue2) {
|
|||
*/
|
||||
template <typename T>
|
||||
static inline T NaNSafeMin(T aValue1, T aValue2) {
|
||||
if (IsNaN(aValue1) || IsNaN(aValue2)) {
|
||||
if (std::isnan(aValue1) || std::isnan(aValue2)) {
|
||||
return UnspecifiedNaN<T>();
|
||||
}
|
||||
return std::min(aValue1, aValue2);
|
||||
|
@ -570,7 +570,7 @@ static inline T NaNSafeMin(T aValue1, T aValue2) {
|
|||
*/
|
||||
template <typename T>
|
||||
static inline T NaNSafeMax(T aValue1, T aValue2) {
|
||||
if (IsNaN(aValue1) || IsNaN(aValue2)) {
|
||||
if (std::isnan(aValue1) || std::isnan(aValue2)) {
|
||||
return UnspecifiedNaN<T>();
|
||||
}
|
||||
return std::max(aValue1, aValue2);
|
||||
|
|
|
@ -463,7 +463,7 @@ static float ParsePrefFloat(const nsCString& aString, nsresult* aError) {
|
|||
// Defensively avoid potential breakage caused by returning NaN into
|
||||
// unsuspecting code. AFAIK this should never happen as PR_strtod cannot
|
||||
// return NaN as currently configured.
|
||||
if (mozilla::IsNaN(result)) {
|
||||
if (std::isnan(result)) {
|
||||
MOZ_ASSERT_UNREACHABLE("PR_strtod shouldn't return NaN");
|
||||
*aError = NS_ERROR_ILLEGAL_VALUE;
|
||||
return 0.f;
|
||||
|
|
|
@ -835,7 +835,7 @@ void TestProportionValue() {
|
|||
}
|
||||
|
||||
// Invalid construction, conversion to double NaN.
|
||||
MOZ_RELEASE_ASSERT(mozilla::IsNaN(ProportionValue::MakeInvalid().ToDouble()));
|
||||
MOZ_RELEASE_ASSERT(std::isnan(ProportionValue::MakeInvalid().ToDouble()));
|
||||
|
||||
using namespace mozilla::literals::ProportionValue_literals;
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ static nsresult CloneArray(uint16_t aInType, const nsIID* aInIID,
|
|||
#define CASE__NUMERIC_CONVERSION_DOUBLE_MIN_MAX_INT(Ctype_, min_, max_) \
|
||||
case nsIDataType::VTYPE_DOUBLE: { \
|
||||
double value = tempData.u.mDoubleValue; \
|
||||
if (mozilla::IsNaN(value) || value < (min_) || value > (max_)) { \
|
||||
if (std::isnan(value) || value < (min_) || value > (max_)) { \
|
||||
return NS_ERROR_LOSS_OF_SIGNIFICANT_DATA; \
|
||||
} \
|
||||
*aResult = (Ctype_)value; \
|
||||
|
@ -557,7 +557,7 @@ nsresult nsDiscriminatedUnion::ConvertToBool(bool* aResult) const {
|
|||
return rv;
|
||||
}
|
||||
// NaN is falsy in JS, so we might as well make it false here.
|
||||
if (mozilla::IsNaN(val)) {
|
||||
if (std::isnan(val)) {
|
||||
*aResult = false;
|
||||
} else {
|
||||
*aResult = 0.0 != val;
|
||||
|
@ -585,7 +585,7 @@ nsresult nsDiscriminatedUnion::ConvertToInt64(int64_t* aResult) const {
|
|||
return rv;
|
||||
case nsIDataType::VTYPE_DOUBLE: {
|
||||
double value = tempData.u.mDoubleValue;
|
||||
if (mozilla::IsNaN(value)) {
|
||||
if (std::isnan(value)) {
|
||||
return NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
|
||||
}
|
||||
// XXX should check for data loss here!
|
||||
|
|
Загрузка…
Ссылка в новой задаче