4#ifndef QJSNUMBERCOERCION_H
5#define QJSNUMBERCOERCION_H
7#include <QtCore/qglobal.h>
20 if (!
equals(
d,
d) ||
d < (std::numeric_limits<int>::min)()
21 ||
d > (std::numeric_limits<int>::max)()) {
25 return equals(
static_cast<int>(
d),
d);
32 &&
d <= (std::numeric_limits<uint>::max)()
38 return i >= 0 &&
i <= (std::numeric_limits<uint>::max)();
43 return i <= (std::numeric_limits<uint>::max)();
51 if (
d >= (std::numeric_limits<int>::min)() &&
d <= (std::numeric_limits<int>::max)()) {
52 const int i =
static_cast<int>(
d);
60 static constexpr bool equals(
double lhs,
double rhs)
75 memcpy(&d, &dbl,
sizeof(
double));
78 constexpr int sign()
const
80 return (d >> 63) ? -1 : 1;
83 constexpr bool isDenormal()
const
85 return static_cast<int>((d << 1) >> 53) == 0;
90 return static_cast<int>((d << 1) >> 53) - 1023;
93 constexpr quint64 significant()
const
97 m |= (
static_cast<quint64>(1) << 52);
107 return sign() *
static_cast<int>(significant() >> -e);
111 return sign() * (
static_cast<int>(significant()) << e);
Implements the JavaScript double-to-int coercion.
static constexpr bool isArrayIndex(qint64 i)
static constexpr bool equals(double lhs, double rhs)
static constexpr bool isArrayIndex(double d)
static constexpr int toInteger(double d)
static constexpr bool isInteger(double d)
static constexpr bool isArrayIndex(quint64 i)
Combined button and popup list for selecting options.
#define QT_WARNING_DISABLE_FLOAT_COMPARE
unsigned long long quint64