aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-11-05 12:18:52 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-11-05 18:14:41 +0000
commit2627e3b7fd820876bc45c99be48aea05351d210a (patch)
tree1fab1db80af6d878a2976fbf0d65f63e6063d172
parent5997e6a6ecc4bf9ed73c213693cd6127c16a2419 (diff)
downloadgcc-2627e3b7fd820876bc45c99be48aea05351d210a.zip
gcc-2627e3b7fd820876bc45c99be48aea05351d210a.tar.gz
gcc-2627e3b7fd820876bc45c99be48aea05351d210a.tar.bz2
libstdc++: Add [[unlikely]] attributes to std::random_device routines
libstdc++-v3/ChangeLog: * src/c++11/random.cc (__x86_rdrand, __x86_rdseed): Add [[unlikely]] attribute.
-rw-r--r--libstdc++-v3/src/c++11/random.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 55a73c5..4b88818 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -97,7 +97,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
unsigned int retries = 100;
unsigned int val;
- while (__builtin_ia32_rdrand32_step(&val) == 0)
+ while (__builtin_ia32_rdrand32_step(&val) == 0) [[__unlikely__]]
if (--retries == 0)
std::__throw_runtime_error(__N("random_device: rdrand failed"));
@@ -113,7 +113,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
unsigned int retries = 100;
unsigned int val;
- while (__builtin_ia32_rdseed_si_step(&val) == 0)
+ while (__builtin_ia32_rdseed_si_step(&val) == 0) [[__unlikely__]]
{
if (--retries == 0)
{