random-util: use gcc's bit_RDRND definition if it exists

This commit is contained in:
Lennart Poettering 2019-05-07 16:21:44 -04:00
parent 1a0ffa1e73
commit cc28145d51

View file

@ -45,7 +45,12 @@ int rdrand(unsigned long *ret) {
return -EOPNOTSUPP;
}
have_rdrand = !!(ecx & (1U << 30));
/* Compat with old gcc where bit_RDRND didn't exist yet */
#ifndef bit_RDRND
#define bit_RDRND (1U << 30)
#endif
have_rdrand = !!(ecx & bit_RDRND);
}
if (have_rdrand == 0)