On 11/2/19 4:24 PM, Richard W.M. Jones wrote:
--- generator/generator | 6 +++--- lib/crypto.c | 2 +- lib/internal.h | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-)
+++ b/lib/internal.h @@ -40,6 +40,18 @@ #include "states.h" #include "unlocked.h"
+/* Define unlikely macro, but only for GCC. These are used to move + * debug and error handling code out of hot paths, making the hot path + * into common functions use less instruction cache. + */ +#if defined(__GNUC__) +#define unlikely(x) __builtin_expect (!!(x), 0) +#define if_debug(h) if (unlikely ((h)->debug)) +#else +#define unlikely(x) (x) +#define if_debug(h) if ((h)->debug) +#endif
Same question about applicability to clang as for nbdkit, otherwise looks fine. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org