Why does GCC hate AMD? amd ryzen has a fully support for rdseed and rdrand instructions and you guys hate amd.
And why not just use intrinsic assembly? We are using C++ not using C. C APIs are always terrible please don’t use them. Also instructions like rdseed requires calling asm volatile(“pause”) after a failed rdseed call from intel’s manual.
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's WHY WHY WHY ???????
if (__get_cpuid_max(0, &ebx) > 0 && ebx == signature_INTEL_ebx)
if (ecx & bit_RDRND)
_M_file = nullptr;
Why do you guys love pointers with useless register pointer function calls? Why do you guys enjoy using shit C APIs. C is a garbage language and should be avoided at all.
What’s wrong with assembly code as simple like this?
throw runtime_error("std::random_device: Your CPU does not support the rdseed instruction.");
Also Who designed this shit? Abusing goto.
Why do you enjoy using shit apis like fopen/fclose? Fopen/fclose has internal buffers which highly chance to be exploited.
const int fd = fileno(static_cast<FILE*>(_M_file));
LOL. Why not just use open/close +buffer directly in order to avoid all issues.
The entire implementation is completely unacceptable from the beginning. Now you guys are doing terrible changes to bits/random.h which potentially breaks ABI.
This class in header is terrible and even worse than libc++’s implementation. Libc++ just uses constructors and destructors as abi and never introduces any other abis.
/** The type of the generated random value. */
typedef unsigned int result_type;