From: Lennart Poettering Date: Tue, 7 May 2019 20:21:44 +0000 (-0400) Subject: random-util: use gcc's bit_RDRND definition if it exists X-Git-Tag: v243-rc1~472^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc28145d51f62711fdc4b4c229aecd5778806419;p=thirdparty%2Fsystemd.git random-util: use gcc's bit_RDRND definition if it exists --- diff --git a/src/basic/random-util.c b/src/basic/random-util.c index de29e07549e..205d5501e51 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -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)