diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-04-05 13:58:20 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-04-05 13:49:27 +0000 |
commit | f63f86f7d38a182b41a85af27bf0baba3db03941 (patch) | |
tree | bc9ebff4b5e0591c106b1bb47b1a1111224a1962 | |
parent | 7c18dcf79abbcc4de085e73ca7abe4eeeb7f140c (diff) |
Replace qQNaN() and friends with qt_qnan().
These constexpr functions can be inlined, and the compiler can be a bit
smarter with code generation.
Change-Id: I4ea87c794dd8e375749e18d273d01bb848231113
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
-rw-r--r-- | src/imports/layouts/qquicklayout.cpp | 14 | ||||
-rw-r--r-- | src/imports/layouts/qquicklinearlayout.cpp | 8 | ||||
-rw-r--r-- | src/particles/qquickv4particledata.cpp | 5 | ||||
-rw-r--r-- | src/qml/compiler/qv4jsir_p.h | 3 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dataview.cpp | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 48 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dateobject_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mathobject.cpp | 64 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4numberobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/parser/qqmljsengine_p.cpp | 6 | ||||
-rw-r--r-- | src/quick/designer/qqmldesignermetaobject.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 6 | ||||
-rw-r--r-- | src/quick/util/qquickpath.cpp | 8 | ||||
-rw-r--r-- | src/quick/util/qquicktimeline.cpp | 8 |
18 files changed, 104 insertions, 101 deletions
diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp index d4d4e1703d..abc8f97cec 100644 --- a/src/imports/layouts/qquicklayout.cpp +++ b/src/imports/layouts/qquicklayout.cpp @@ -40,7 +40,7 @@ #include "qquicklayout_p.h" #include <QEvent> #include <QtCore/qcoreapplication.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QtCore/qmath.h> #include <limits> @@ -134,7 +134,7 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent) */ void QQuickLayoutAttached::setMinimumWidth(qreal width) { - if (qIsNaN(width)) + if (qt_is_nan(width)) return; m_isMinimumWidthSet = width >= 0; if (m_minimumWidth == width) @@ -162,7 +162,7 @@ void QQuickLayoutAttached::setMinimumWidth(qreal width) */ void QQuickLayoutAttached::setMinimumHeight(qreal height) { - if (qIsNaN(height)) + if (qt_is_nan(height)) return; m_isMinimumHeightSet = height >= 0; if (m_minimumHeight == height) @@ -186,7 +186,7 @@ void QQuickLayoutAttached::setMinimumHeight(qreal height) */ void QQuickLayoutAttached::setPreferredWidth(qreal width) { - if (qIsNaN(width) || m_preferredWidth == width) + if (qt_is_nan(width) || m_preferredWidth == width) return; m_preferredWidth = width; @@ -207,7 +207,7 @@ void QQuickLayoutAttached::setPreferredWidth(qreal width) */ void QQuickLayoutAttached::setPreferredHeight(qreal height) { - if (qIsNaN(height) || m_preferredHeight == height) + if (qt_is_nan(height) || m_preferredHeight == height) return; m_preferredHeight = height; @@ -232,7 +232,7 @@ void QQuickLayoutAttached::setPreferredHeight(qreal height) */ void QQuickLayoutAttached::setMaximumWidth(qreal width) { - if (qIsNaN(width)) + if (qt_is_nan(width)) return; m_isMaximumWidthSet = width >= 0; if (m_maximumWidth == width) @@ -259,7 +259,7 @@ void QQuickLayoutAttached::setMaximumWidth(qreal width) */ void QQuickLayoutAttached::setMaximumHeight(qreal height) { - if (qIsNaN(height)) + if (qt_is_nan(height)) return; m_isMaximumHeightSet = height >= 0; if (m_maximumHeight == height) diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index 2f8af4c58b..0b4a1968d7 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -40,7 +40,7 @@ #include "qquicklinearlayout_p.h" #include "qquickgridlayoutengine_p.h" #include "qquicklayoutstyleinfo_p.h" -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include "qdebug.h" #include <limits> @@ -566,7 +566,7 @@ qreal QQuickGridLayout::columnSpacing() const void QQuickGridLayout::setColumnSpacing(qreal spacing) { Q_D(QQuickGridLayout); - if (qIsNaN(spacing) || columnSpacing() == spacing) + if (qt_is_nan(spacing) || columnSpacing() == spacing) return; d->engine.setSpacing(spacing, Qt::Horizontal); @@ -588,7 +588,7 @@ qreal QQuickGridLayout::rowSpacing() const void QQuickGridLayout::setRowSpacing(qreal spacing) { Q_D(QQuickGridLayout); - if (qIsNaN(spacing) || rowSpacing() == spacing) + if (qt_is_nan(spacing) || rowSpacing() == spacing) return; d->engine.setSpacing(spacing, Qt::Vertical); @@ -867,7 +867,7 @@ qreal QQuickLinearLayout::spacing() const void QQuickLinearLayout::setSpacing(qreal space) { Q_D(QQuickLinearLayout); - if (qIsNaN(space) || spacing() == space) + if (qt_is_nan(space) || spacing() == space) return; d->engine.setSpacing(space, Qt::Horizontal | Qt::Vertical); diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp index 3d7f4ce5b8..99451057ce 100644 --- a/src/particles/qquickv4particledata.cpp +++ b/src/particles/qquickv4particledata.cpp @@ -43,6 +43,7 @@ #include <QDebug> #include <private/qv4engine_p.h> #include <private/qv4functionobject_p.h> +#include <QtCore/private/qnumeric_p.h> QT_BEGIN_NAMESPACE @@ -388,7 +389,7 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\ if (!r || !r->d()->datum)\ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\ \ - r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();\ + r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();\ return QV4::Encode::undefined(); \ } @@ -409,7 +410,7 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\ if (!r || !r->d()->datum)\ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\ \ - r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(), r->d()->particleSystem);\ + r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(), r->d()->particleSystem);\ return QV4::Encode::undefined(); \ } diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h index eafecae494..26b06561a8 100644 --- a/src/qml/compiler/qv4jsir_p.h +++ b/src/qml/compiler/qv4jsir_p.h @@ -55,6 +55,7 @@ #include <private/qqmljsastfwd_p.h> #include <private/qflagpointer_p.h> +#include <QtCore/private/qnumeric_p.h> #include <QtCore/QVector> #include <QtCore/QString> #include <QtCore/QBitArray> @@ -1344,7 +1345,7 @@ inline Expr *BasicBlock::CONST(Type type, double value) } else if (type == NullType) { value = 0; } else if (type == UndefinedType) { - value = qQNaN(); + value = qt_qnan(); } e->init(type, value); diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index f7cdd1b0b5..f021e1f760 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2667,7 +2667,7 @@ void convertConst(Const *c, Type targetType) break; case NullType: case UndefinedType: - c->value = qQNaN(); + c->value = qt_qnan(); c->type = targetType; default: Q_UNIMPLEMENTED(); diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index b4422bcdc6..f296ffd71e 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -41,6 +41,7 @@ #include "qv4arraybuffer_p.h" #include "qv4string_p.h" +#include <QtCore/private/qnumeric_p.h> #include "qendian.h" using namespace QV4; @@ -291,7 +292,7 @@ ReturnedValue DataViewPrototype::method_setFloat(CallContext *ctx) return scope.engine->throwTypeError(); idx += v->d()->byteOffset; - double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qQNaN(); + double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qt_qnan(); bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean(); if (sizeof(T) == 4) { diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 7051d5c3a5..8e4ebb3cb0 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -204,7 +204,7 @@ static inline double MonthFromTime(double t) else if (d < 365.0 + l) return 11; - return qQNaN(); // ### assert? + return qt_qnan(); // ### assert? } static inline double DateFromTime(double t) @@ -228,7 +228,7 @@ static inline double DateFromTime(double t) case 11: return d - 333.0 - l; } - return qQNaN(); // ### assert + return qt_qnan(); // ### assert } static inline double WeekDay(double t) @@ -260,7 +260,7 @@ static inline double DayFromMonth(double month, double leap) case 11: return 334.0 + leap; } - return qQNaN(); // ### assert? + return qt_qnan(); // ### assert? } static double MakeDay(double year, double month, double day) @@ -339,7 +339,7 @@ static inline double currentTime() static inline double TimeClip(double t) { if (! qIsFinite(t) || fabs(t) > 8.64e15) - return qQNaN(); + return qt_qnan(); return Primitive::toInteger(t); } @@ -544,7 +544,7 @@ static inline double ParseString(const QString &s) } } if (!dt.isValid()) - return qQNaN(); + return qt_qnan(); return dt.toMSecsSinceEpoch(); } @@ -636,7 +636,7 @@ DEFINE_OBJECT_VTABLE(DateObject); Heap::DateObject::DateObject(const QDateTime &date) { - this->date = date.isValid() ? date.toMSecsSinceEpoch() : qQNaN(); + this->date = date.isValid() ? date.toMSecsSinceEpoch() : qt_qnan(); } QDateTime DateObject::toQDateTime() const @@ -770,7 +770,7 @@ double DatePrototype::getThisDate(ExecutionContext *ctx) ReturnedValue DatePrototype::method_parse(CallContext *ctx) { if (!ctx->argc()) - return Encode(qQNaN()); + return Encode(qt_qnan()); return Encode(ParseString(ctx->args()[0].toQString())); } @@ -1000,7 +1000,7 @@ ReturnedValue DatePrototype::method_setTime(CallContext *ctx) if (!self) return ctx->engine()->throwTypeError(); - double t = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double t = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); self->setDate(TimeClip(t)); return Encode(self->date()); } @@ -1013,7 +1013,7 @@ ReturnedValue DatePrototype::method_setMilliseconds(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double ms = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double ms = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); self->setDate(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms))))); return Encode(self->date()); } @@ -1025,7 +1025,7 @@ ReturnedValue DatePrototype::method_setUTCMilliseconds(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double ms = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double ms = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); self->setDate(TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))); return Encode(self->date()); } @@ -1037,7 +1037,7 @@ ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double sec = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double sec = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber(); t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms)))); self->setDate(t); @@ -1051,7 +1051,7 @@ ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double sec = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double sec = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber(); t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))); self->setDate(t); @@ -1065,7 +1065,7 @@ ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double min = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double min = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber(); double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber(); t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms)))); @@ -1080,7 +1080,7 @@ ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double min = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double min = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber(); double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber(); t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))); @@ -1095,7 +1095,7 @@ ReturnedValue DatePrototype::method_setHours(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double hour = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double hour = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber(); double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber(); double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber(); @@ -1111,7 +1111,7 @@ ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double hour = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double hour = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber(); double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber(); double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber(); @@ -1127,7 +1127,7 @@ ReturnedValue DatePrototype::method_setDate(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double date = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double date = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t)))); self->setDate(t); return Encode(self->date()); @@ -1140,7 +1140,7 @@ ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double date = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double date = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); t = TimeClip(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))); self->setDate(t); return Encode(self->date()); @@ -1153,7 +1153,7 @@ ReturnedValue DatePrototype::method_setMonth(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = LocalTime(self->date()); - double month = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double month = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber(); t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t)))); self->setDate(t); @@ -1167,7 +1167,7 @@ ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double month = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double month = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber(); t = TimeClip(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))); self->setDate(t); @@ -1185,10 +1185,10 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx) t = 0; else t = LocalTime(t); - double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double r; if (std::isnan(year)) { - r = qQNaN(); + r = qt_qnan(); } else { if ((Primitive::toInteger(year) >= 0) && (Primitive::toInteger(year) <= 99)) year += 1900; @@ -1207,7 +1207,7 @@ ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx) return ctx->engine()->throwTypeError(); double t = self->date(); - double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber(); double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber(); t = TimeClip(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))); @@ -1224,7 +1224,7 @@ ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx) double t = LocalTime(self->date()); if (std::isnan(t)) t = 0; - double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber(); double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber(); t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t)))); diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index edf5d625fd..e3615d76a7 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -52,7 +52,7 @@ #include "qv4object_p.h" #include "qv4functionobject_p.h" -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> QT_BEGIN_NAMESPACE @@ -65,7 +65,7 @@ namespace Heap { struct DateObject : Object { DateObject() { - date = qQNaN(); + date = qt_qnan(); } DateObject(const Value &date) diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp index 8c5e7d8be1..4a304b6138 100644 --- a/src/qml/jsruntime/qv4mathobject.cpp +++ b/src/qml/jsruntime/qv4mathobject.cpp @@ -42,7 +42,7 @@ #include <QtCore/qdatetime.h> #include <QtCore/qmath.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QtCore/qthreadstorage.h> #include <cmath> @@ -100,7 +100,7 @@ static double copySign(double x, double y) ReturnedValue MathObject::method_abs(CallContext *context) { if (!context->argc()) - return Encode(qQNaN()); + return Encode(qt_qnan()); if (context->args()[0].isInteger()) { int i = context->args()[0].integerValue(); @@ -118,7 +118,7 @@ ReturnedValue MathObject::method_acos(CallContext *context) { double v = context->argc() ? context->args()[0].toNumber() : 2; if (v > 1) - return Encode(qQNaN()); + return Encode(qt_qnan()); return Encode(std::acos(v)); } @@ -127,14 +127,14 @@ ReturnedValue MathObject::method_asin(CallContext *context) { double v = context->argc() ? context->args()[0].toNumber() : 2; if (v > 1) - return Encode(qQNaN()); + return Encode(qt_qnan()); else return Encode(std::asin(v)); } ReturnedValue MathObject::method_atan(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); if (v == 0.0) return Encode(v); else @@ -143,10 +143,10 @@ ReturnedValue MathObject::method_atan(CallContext *context) ReturnedValue MathObject::method_atan2(CallContext *context) { - double v1 = context->argc() ? context->args()[0].toNumber() : qQNaN(); - double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qQNaN(); + double v1 = context->argc() ? context->args()[0].toNumber() : qt_qnan(); + double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qt_qnan(); - if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0)) + if ((v1 < 0) && qt_is_finite(v1) && qt_is_inf(v2) && (copySign(1.0, v2) == 1.0)) return Encode(copySign(0, -1.0)); if ((v1 == 0.0) && (v2 == 0.0)) { @@ -161,7 +161,7 @@ ReturnedValue MathObject::method_atan2(CallContext *context) ReturnedValue MathObject::method_ceil(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); if (v < 0.0 && v > -1.0) return Encode(copySign(0, -1.0)); else @@ -170,18 +170,18 @@ ReturnedValue MathObject::method_ceil(CallContext *context) ReturnedValue MathObject::method_cos(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); return Encode(std::cos(v)); } ReturnedValue MathObject::method_exp(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); - if (qIsInf(v)) { + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); + if (qt_is_inf(v)) { if (copySign(1.0, v) == -1.0) return Encode(0); else - return Encode(qInf()); + return Encode(qt_inf()); } else { return Encode(std::exp(v)); } @@ -189,22 +189,22 @@ ReturnedValue MathObject::method_exp(CallContext *context) ReturnedValue MathObject::method_floor(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); return Encode(std::floor(v)); } ReturnedValue MathObject::method_log(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); if (v < 0) - return Encode(qQNaN()); + return Encode(qt_qnan()); else return Encode(std::log(v)); } ReturnedValue MathObject::method_max(CallContext *context) { - double mx = -qInf(); + double mx = -qt_inf(); for (int i = 0; i < context->argc(); ++i) { double x = context->args()[i].toNumber(); if (x > mx || std::isnan(x)) @@ -215,7 +215,7 @@ ReturnedValue MathObject::method_max(CallContext *context) ReturnedValue MathObject::method_min(CallContext *context) { - double mx = qInf(); + double mx = qt_inf(); for (int i = 0; i < context->argc(); ++i) { double x = context->args()[i].toNumber(); if ((x == 0 && mx == x && copySign(1.0, x) == -1.0) @@ -228,24 +228,24 @@ ReturnedValue MathObject::method_min(CallContext *context) ReturnedValue MathObject::method_pow(CallContext *context) { - double x = context->argc() > 0 ? context->args()[0].toNumber() : qQNaN(); - double y = context->argc() > 1 ? context->args()[1].toNumber() : qQNaN(); + double x = context->argc() > 0 ? context->args()[0].toNumber() : qt_qnan(); + double y = context->argc() > 1 ? context->args()[1].toNumber() : qt_qnan(); if (std::isnan(y)) - return Encode(qQNaN()); + return Encode(qt_qnan()); if (y == 0) { return Encode(1); } else if (((x == 1) || (x == -1)) && std::isinf(y)) { - return Encode(qQNaN()); + return Encode(qt_qnan()); } else if (((x == 0) && copySign(1.0, x) == 1.0) && (y < 0)) { return Encode(qInf()); } else if ((x == 0) && copySign(1.0, x) == -1.0) { if (y < 0) { if (std::fmod(-y, 2.0) == 1.0) - return Encode(-qInf()); + return Encode(-qt_inf()); else - return Encode(qInf()); + return Encode(qt_inf()); } else if (y > 0) { if (std::fmod(y, 2.0) == 1.0) return Encode(copySign(0, -1.0)); @@ -255,12 +255,12 @@ ReturnedValue MathObject::method_pow(CallContext *context) } #ifdef Q_OS_AIX - else if (qIsInf(x) && copySign(1.0, x) == -1.0) { + else if (qt_is_inf(x) && copySign(1.0, x) == -1.0) { if (y > 0) { if (std::fmod(y, 2.0) == 1.0) - return Encode(-qInf()); + return Encode(-qt_inf()); else - return Encode(qInf()); + return Encode(qt_inf()); } else if (y < 0) { if (std::fmod(-y, 2.0) == 1.0) return Encode(copySign(0, -1.0)); @@ -273,7 +273,7 @@ ReturnedValue MathObject::method_pow(CallContext *context) return Encode(std::pow(x, y)); } // ### - return Encode(qQNaN()); + return Encode(qt_qnan()); } Q_GLOBAL_STATIC(QThreadStorage<bool *>, seedCreatedStorage); @@ -294,26 +294,26 @@ ReturnedValue MathObject::method_random(CallContext *context) ReturnedValue MathObject::method_round(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); v = copySign(std::floor(v + 0.5), v); return Encode(v); } ReturnedValue MathObject::method_sin(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); return Encode(std::sin(v)); } ReturnedValue MathObject::method_sqrt(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); return Encode(std::sqrt(v)); } ReturnedValue MathObject::method_tan(CallContext *context) { - double v = context->argc() ? context->args()[0].toNumber() : qQNaN(); + double v = context->argc() ? context->args()[0].toNumber() : qt_qnan(); if (v == 0.0) return Encode(v); else diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 5cf7dbebd8..ab3e03b183 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -95,7 +95,7 @@ void NumberPrototype::init(ExecutionEngine *engine, Object *ctor) ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(1)); - ctor->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(qQNaN())); + ctor->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(qt_qnan())); ctor->defineReadonlyProperty(QStringLiteral("NEGATIVE_INFINITY"), Primitive::fromDouble(-qInf())); ctor->defineReadonlyProperty(QStringLiteral("POSITIVE_INFINITY"), Primitive::fromDouble(qInf())); ctor->defineReadonlyProperty(QStringLiteral("MAX_VALUE"), Primitive::fromDouble(1.7976931348623158e+308)); @@ -149,7 +149,7 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx) if (std::isnan(num)) { return scope.engine->newString(QStringLiteral("NaN"))->asReturnedValue(); - } else if (qIsInf(num)) { + } else if (qt_is_inf(num)) { return scope.engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue(); } @@ -223,7 +223,7 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx) QString str; if (std::isnan(v)) str = QStringLiteral("NaN"); - else if (qIsInf(v)) + else if (qt_is_inf(v)) str = QString::fromLatin1(v < 0 ? "-Infinity" : "Infinity"); else if (v < 1.e21) str = NumberLocale::instance()->toString(v, 'f', int(fdigits)); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 373e7fc8de..92971e2298 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -225,7 +225,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) if (std::isnan(num)) { *result = QStringLiteral("NaN"); return; - } else if (qIsInf(num)) { + } else if (qt_is_inf(num)) { *result = num < 0 ? QStringLiteral("-Infinity") : QStringLiteral("Infinity"); return; } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 5adc5beea5..b874766655 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -270,7 +270,7 @@ ReturnedValue StringPrototype::method_charCodeAt(CallContext *context) if (pos >= 0 && pos < str.length()) return Encode(str.at(pos).unicode()); - return Encode(qQNaN()); + return Encode(qt_qnan()); } ReturnedValue StringPrototype::method_concat(CallContext *context) diff --git a/src/qml/parser/qqmljsengine_p.cpp b/src/qml/parser/qqmljsengine_p.cpp index d3b3af317c..07064a4889 100644 --- a/src/qml/parser/qqmljsengine_p.cpp +++ b/src/qml/parser/qqmljsengine_p.cpp @@ -40,7 +40,7 @@ #include "qqmljsengine_p.h" #include "qqmljsglobal_p.h" -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QtCore/qhash.h> #include <QtCore/qdebug.h> @@ -62,7 +62,7 @@ static inline int toDigit(char c) double integerFromString(const char *buf, int size, int radix) { if (size == 0) - return qQNaN(); + return qt_qnan(); double sign = 1.0; int i = 0; @@ -101,7 +101,7 @@ double integerFromString(const char *buf, int size, int radix) if (!qstrcmp(buf, "Infinity")) result = qInf(); else - result = qQNaN(); + result = qt_qnan(); } else { result = 0; double multiplier = 1; diff --git a/src/quick/designer/qqmldesignermetaobject.cpp b/src/quick/designer/qqmldesignermetaobject.cpp index f238740504..46808f978b 100644 --- a/src/quick/designer/qqmldesignermetaobject.cpp +++ b/src/quick/designer/qqmldesignermetaobject.cpp @@ -41,7 +41,7 @@ #include <QSharedPointer> #include <QMetaProperty> -#include <qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QDebug> #include <private/qqmlengine_p.h> @@ -271,19 +271,19 @@ int QQmlDesignerMetaObject::metaCall(QObject *o, QMetaObject::Call call, int id, if (call == QMetaObject::WriteProperty && propertyById.userType() == QMetaType::QVariant && reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double - && qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) { + && qt_is_nan(reinterpret_cast<QVariant *>(a[0])->toDouble())) { return -1; } if (call == QMetaObject::WriteProperty && propertyById.userType() == QMetaType::Double - && qIsNaN(*reinterpret_cast<double*>(a[0]))) { + && qt_is_nan(*reinterpret_cast<double*>(a[0]))) { return -1; } if (call == QMetaObject::WriteProperty && propertyById.userType() == QMetaType::Float - && qIsNaN(*reinterpret_cast<float*>(a[0]))) { + && qt_is_nan(*reinterpret_cast<float*>(a[0]))) { return -1; } diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index bacdfad557..56578b5f16 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -65,7 +65,7 @@ #include <private/qv4scopedvalue_p.h> #include <QtCore/qmath.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QtCore/QRunnable> #include <QtGui/qguiapplication.h> #include <QtGui/qopenglframebufferobject.h> @@ -1256,7 +1256,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *c QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>()); CHECK_CONTEXT_SETTER(r) - double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); if (!qIsFinite(globalAlpha)) return QV4::Encode::undefined(); @@ -2006,7 +2006,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject()); CHECK_CONTEXT_SETTER(r) - qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); if (qIsFinite(offsetX) && offsetX != r->d()->context->state.shadowOffsetX) { r->d()->context->state.shadowOffsetX = offsetX; r->d()->context->buffer()->setShadowOffsetX(offsetX); @@ -2034,7 +2034,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject()); CHECK_CONTEXT_SETTER(r) - qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(); + qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(); if (qIsFinite(offsetY) && offsetY != r->d()->context->state.shadowOffsetY) { r->d()->context->state.shadowOffsetY = offsetY; r->d()->context->buffer()->setShadowOffsetY(offsetY); diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 0c5c6e6c30..0750dc94b1 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -56,7 +56,7 @@ #include <QtGui/private/qguiapplication_p.h> #include <QtGui/qinputmethod.h> #include <QtCore/qcoreevent.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> #include <QtGui/qpa/qplatformtheme.h> #include <QtCore/qloggingcategory.h> @@ -6307,7 +6307,7 @@ qreal QQuickItem::width() const void QQuickItem::setWidth(qreal w) { Q_D(QQuickItem); - if (qIsNaN(w)) + if (qt_is_nan(w)) return; d->widthValid = true; @@ -6471,7 +6471,7 @@ qreal QQuickItem::height() const void QQuickItem::setHeight(qreal h) { Q_D(QQuickItem); - if (qIsNaN(h)) + if (qt_is_nan(h)) return; d->heightValid = true; diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 062411e0a9..6b491a433c 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -46,7 +46,7 @@ #include <private/qbezier_p.h> #include <QtCore/qmath.h> -#include <QtCore/qnumeric.h> +#include <QtCore/private/qnumeric_p.h> QT_BEGIN_NAMESPACE @@ -560,7 +560,7 @@ void QQuickPath::createPointCache() const { Q_D(const QQuickPath); qreal pathLength = d->pathLength; - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return; const int segments = segmentCount(d->_path, pathLength); @@ -633,7 +633,7 @@ QPointF QQuickPath::sequentialPointAt(const QPainterPath &path, const qreal &pat QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) { - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return path.pointAtPercent(0); //expensive? const int lastElement = path.elementCount() - 1; @@ -689,7 +689,7 @@ QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathL //ideally this should be merged with forwardsPointAt QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle) { - if (pathLength <= 0 || qIsNaN(pathLength)) + if (pathLength <= 0 || qt_is_nan(pathLength)) return path.pointAtPercent(0); const int firstElement = 1; //element 0 is always a MoveTo, which we ignore diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index d8226a08f3..74baa3bfda 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -47,7 +47,7 @@ #include <QCoreApplication> #include <QEasingCurve> #include <QTime> -#include <QtNumeric> +#include <QtCore/private/qnumeric_p.h> #include <algorithm> @@ -387,7 +387,7 @@ void QQuickTimeLine::set(QQuickTimeLineValue &timeLineValue, qreal value) */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration) { - if (qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) + if (qFuzzyIsNull(acceleration) || qt_is_nan(acceleration)) return -1; if ((velocity > 0.0f) == (acceleration > 0.0f)) @@ -414,7 +414,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance) { - if (qFuzzyIsNull(maxDistance) || qIsNaN(maxDistance) || qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) + if (qFuzzyIsNull(maxDistance) || qt_is_nan(maxDistance) || qFuzzyIsNull(acceleration) || qt_is_nan(acceleration)) return -1; Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f); @@ -444,7 +444,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accelDistance(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal distance) { - if (qFuzzyIsNull(distance) || qIsNaN(distance) || qFuzzyIsNull(velocity) || qIsNaN(velocity)) + if (qFuzzyIsNull(distance) || qt_is_nan(distance) || qFuzzyIsNull(velocity) || qt_is_nan(velocity)) return -1; Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f)); |