libstdc++: Add [[unlikely]] attributes to std::random_device routines
libstdc++-v3/ChangeLog: * src/c++11/random.cc (__x86_rdrand, __x86_rdseed): Add [[unlikely]] attribute.
This commit is contained in:
parent
5997e6a6ec
commit
2627e3b7fd
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue