aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2012-09-05 13:54:57 +0000
committerUlrich Drepper <drepper@gcc.gnu.org>2012-09-05 13:54:57 +0000
commitefc622f843e3db6a4da4112ef411abf935048438 (patch)
tree35536fd01d0e8f272a2b4058c98ecde1b41ccd1a /libstdc++-v3
parent4700dd70e183e91a3ff6014ddcd59f68c526d02b (diff)
downloadgcc-efc622f843e3db6a4da4112ef411abf935048438.zip
gcc-efc622f843e3db6a4da4112ef411abf935048438.tar.gz
gcc-efc622f843e3db6a4da4112ef411abf935048438.tar.bz2
random.cc (random_device::_M_init): Check whether cpuid instruction is available by using __get_cpuid_max.
* src/c++11/random.cc (random_device::_M_init): Check whether cpuid instruction is available by using __get_cpuid_max. From-SVN: r190982
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/src/c++11/random.cc7
2 files changed, 6 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b7fb795..fa11b34 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2012-09-05 Ulrich Drepper <drepper@gmail.com>
+ * src/c++11/random.cc (random_device::_M_init): Check whether cpuid
+ instruction is available by using __get_cpuid_max.
+
* include/ext/random.tcc (__gnu_cxx:normal_mv_distribution<>)
(operator()): Use __generate() function of _M_nd.
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index cabc388..f5ee9f4 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -77,9 +77,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
#if defined __i386__ || defined __x86_64__
unsigned int eax, ebx, ecx, edx;
- __cpuid(0, eax, ebx, ecx, edx);
- // Check for "GenuineIntel"
- if (ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69)
+ // Check availability of cpuid and, for now at least, also the
+ // CPU signature for Intel's
+ if (__get_cpuid_max(0, &ebx) > 0 && ebx == 0x756e6547)
{
__cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_RDRND)
@@ -104,7 +104,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
void
random_device::_M_init_pretr1(const std::string& token)
-
{
_M_mt.seed(_M_strtoul(token));
}