This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: out-of-line and arch-specific random_device
On Tue, Aug 28, 2012 at 3:47 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
> I assume they are different enough that they can't all be abstracted
> behind a nice common builtin (with default implementation in libgcc
> and/or a macro advertising fast implementations of it) :-(
What is different is the way to interact with the CPU facility to get
the data. That's exactly the part I abstracted out in its own
function. I named it __x86_rdrand() but that's more an historic
accident. I should have named it __get_random_word. Then all that
needs to be done for another architecture is to provide a definition
of this function. The rest can be shared. But this function needs to
be arch-specific since the details really differ sufficiently.