aboutsummaryrefslogtreecommitdiffstats
path: root/qmljs_value.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-12 23:43:53 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-12 16:04:53 +0100
commit949303cd7da0edcab235bc19d5fad7d4af7eaed3 (patch)
tree8fd968a837d10dbc18b3a1135f2be41dfda838fa /qmljs_value.h
parent42ebe165489b5429d1e1dc9f850bbf7d37dd127f (diff)
Fix isNaN and isFinite
We need to convert objects to numbers before doing the check. Change-Id: Ie25128b6145845a3eb3e0098f5c5fc09f2be6830 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_value.h')
-rw-r--r--qmljs_value.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/qmljs_value.h b/qmljs_value.h
index 3d29deb326..7f095caf87 100644
--- a/qmljs_value.h
+++ b/qmljs_value.h
@@ -205,6 +205,10 @@ struct Value
inline bool isPrimitive() const { return !isObject(); }
#if CPU(X86_64)
+ inline bool integerCompatible() const {
+ const quint64 mask = quint64(ConvertibleToInt) << 32;
+ return (val & mask) == mask;
+ }
static inline bool integerCompatible(Value a, Value b) {
const quint64 mask = quint64(ConvertibleToInt) << 32;
return ((a.val & b.val) & mask) == mask;
@@ -214,6 +218,9 @@ struct Value
return ((a.val | b.val) & mask) != mask;
}
#else
+ inline bool integerCompatible() const {
+ return (tag & ConvertibleToInt) == ConvertibleToInt;
+ }
static inline bool integerCompatible(Value a, Value b) {
return ((a.tag & b.tag) & ConvertibleToInt) == ConvertibleToInt;
}