Skip to content

Instantly share code, notes, and snippets.

@aburan28
Created January 17, 2017 21:17
Show Gist options
  • Save aburan28/c05622ff502b1db276791043d3a60cb8 to your computer and use it in GitHub Desktop.
Save aburan28/c05622ff502b1db276791043d3a60cb8 to your computer and use it in GitHub Desktop.
int rdseed16_step (uint16_t *seed)
{
unsigned char ok;
asm volatile ("rdseed %0; setc %1"
: "=r" (*seed), "=qm" (ok));
return (int) ok;
}
int rdseed32_step (uint32_t *seed)
{
unsigned char ok;
asm volatile ("rdseed %0; setc %1"
: "=r" (*seed), "=qm" (ok));
return (int) ok;
}
int rdseed64_step (uint64_t *seed)
{
unsigned char ok;
asm volatile ("rdseed %0; setc %1"
: "=r" (*seed), "=qm" (ok));
return (int) ok;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment