]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
random-util: use gcc's bit_RDRND definition if it exists
authorLennart Poettering <lennart@poettering.net>
Tue, 7 May 2019 20:21:44 +0000 (16:21 -0400)
committerLennart Poettering <lennart@poettering.net>
Tue, 7 May 2019 21:31:20 +0000 (17:31 -0400)
src/basic/random-util.c

index de29e07549e7136f0c13b1c93d5e94fdb3a285b3..205d5501e5187c318a0bf8e24bccf8466bab06b4 100644 (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)