qsimd_p.h: group the two HWRNG-related functions

Change-Id: Ic15405335d804bdea761fffd16d50c62ebdf6c0d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2022-02-18 17:40:57 -08:00
parent ec39010390
commit ff63a38bb8

View File

@ -398,14 +398,23 @@ static inline quint64 qCpuFeatures()
#define qCpuHasFeature(feature) (((qCompilerCpuFeatures & CpuFeature ## feature) == CpuFeature ## feature) \
|| ((qCpuFeatures() & CpuFeature ## feature) == CpuFeature ## feature))
inline bool qHasHwrng()
# if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) && !defined(QT_BOOTSTRAPPED)
Q_CORE_EXPORT qsizetype qRandomCpu(void *, qsizetype) noexcept;
static inline bool qHasHwrng()
{
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
return qCpuHasFeature(RDRND);
#else
return false;
#endif
}
# else
static inline qsizetype qRandomCpu(void *, qsizetype) noexcept
{
return 0;
}
static inline bool qHasHwrng()
{
return false;
}
# endif
QT_END_NAMESPACE