aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/utils.h')
-rw-r--r--libcrystfel/src/utils.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index 4478f179..2f2009d6 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -228,7 +228,6 @@ static inline int within_tolerance(double a, double b, double percent)
/* Photon energy (eV) to wavelength (m) */
#define ph_eV_to_lambda(a) ph_en_to_lambda(eV_to_J(a))
-#define UNUSED __attribute__((unused))
/* ------------------------------ Message macros ---------------------------- */
@@ -261,6 +260,19 @@ extern pthread_mutex_t stderr_lock;
extern char *check_prefix(char *prefix);
extern char *safe_basename(const char *in);
+
+/* ------------------------------ Useful stuff ------------------------------ */
+
+#if __GNUC__ >= 3
+#define UNUSED __attribute__((unused))
+#define likely(x) __builtin_expect (!!(x), 1)
+#define unlikely(x) __builtin_expect (!!(x), 0)
+#else
+#define UNUSED
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
#ifdef __cplusplus
}
#endif