From: Erik Verbruggen Date: Tue, 30 Jul 2013 14:53:03 +0000 (+0200) Subject: Add utility conversion methods for use in the JIT. X-Git-Tag: upstream/5.2.1~696 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c148d457c9fb21d61bfcfc4dee2be08a81aae23;p=platform%2Fupstream%2Fqtdeclarative.git Add utility conversion methods for use in the JIT. Change-Id: Iec3eeb849df924919662e8d2ca6593d66c70e3eb Reviewed-by: Lars Knoll --- diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index ed2c146..76e908c 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1245,6 +1245,25 @@ void __qmljs_decrement(Value *result, const Value &value) } } +int __qmljs_value_to_int32(const Value &value) +{ + return value.toInt32(); +} + +int __qmljs_double_to_int32(double d) +{ + return Value::toInt32(d); +} + +unsigned __qmljs_value_to_uint32(const Value &value) +{ + return value.toUInt32(); +} + +unsigned __qmljs_double_to_uint32(double d) +{ + return Value::toUInt32(d); +} } // namespace QV4 QT_END_NAMESPACE diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index 836aedf..dd75e6f 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -299,6 +299,11 @@ inline double __qmljs_to_number(const QV4::Value &value) } } +Q_QML_EXPORT int __qmljs_value_to_int32(const QV4::Value &value); +Q_QML_EXPORT int __qmljs_double_to_int32(double); +Q_QML_EXPORT unsigned __qmljs_value_to_uint32(const QV4::Value &value); +Q_QML_EXPORT unsigned __qmljs_double_to_uint32(double); + inline QV4::Value __qmljs_to_string(const QV4::Value &value, QV4::ExecutionContext *ctx) { if (value.isString())