summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qrandom_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-11-30 00:51:32 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-11-30 00:51:32 +0000
commit498ef7f9d77fca75bcba2f657aaac38c8dc78aea (patch)
tree025636092945c4d8c0e9de6fa69db15da204b648 /src/corelib/global/qrandom_p.h
parent4d0add31fd0a69aca7c7c852f22531dd98922c62 (diff)
parent153e8b49adfe210cb00490284a14c94c08e03c3f (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/global/qrandom_p.h')
-rw-r--r--src/corelib/global/qrandom_p.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/corelib/global/qrandom_p.h b/src/corelib/global/qrandom_p.h
index 6ac2904e1b..917a91098e 100644
--- a/src/corelib/global/qrandom_p.h
+++ b/src/corelib/global/qrandom_p.h
@@ -52,11 +52,12 @@
//
#include "qglobal_p.h"
+#include <private/qsimd_p.h>
QT_BEGIN_NAMESPACE
enum QRandomGeneratorControl {
- SkipMemfill = 1,
+ UseSystemRNG = 1,
SkipSystemRNG = 2,
SkipHWRNG = 4,
SetRandomData = 8,
@@ -65,6 +66,11 @@ enum QRandomGeneratorControl {
RandomDataMask = 0xfffffff0
};
+enum RNGType {
+ SystemRNG = 0,
+ MersenneTwister = 1
+};
+
#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILD_CORE_LIB)
Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC_INITIALIZER(0U);
#elif defined(QT_BUILD_INTERNAL)
@@ -73,6 +79,16 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control;
enum { qt_randomdevice_control = 0 };
#endif
+inline bool qt_has_hwrng()
+{
+#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
+ return qCpuHasFeature(RDRND);
+#else
+ return false;
+#endif
+}
+
+
QT_END_NAMESPACE
#endif // QRANDOM_P_H