If you look at <immintrin.h> (mine is located in `/usr/lib/gcc/x86_64-linux-gnu/4.9/include/ ', Ubuntu 15.04 64bit), there are compatible ones (with MSVC, Intel CC functions) that transmit data back to GCC built-in modules
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _rdrand64_step (unsigned long long *__P) { return __builtin_ia32_rdrand64_step (__P); }
for a 64-bit parameter and two others for 16-bit and 32-bit parameters
_rdrand16_step (unsigned short *__P) _rdrand32_step (unsigned int *__P)
You must use them to make your code compatible with MSVC, Intel CC and other compilers.
_rdrand64_step will populate the 64-bit parameter passed by the pointer, with random bits and a return code. Same for 32-bit and 16-bit versions
UPDATE
"These built-in functions generate random numbers of 16/32/64 bit random integers. The generated random value is written to the given memory location and the success status is returned:" 1 "if the hardware returned a valid random value, and '0' otherwise.
https://software.intel.com/en-us/node/523864
Severin pappadeux
source share