UAVCAN_LIKELY(), UAVCAN_UNLIKELY()

This commit is contained in:
Pavel Kirienko
2015-10-16 15:50:33 +03:00
parent 660e84e17f
commit 6d29f0e405
+16
View File
@@ -167,6 +167,22 @@
# endif
#endif
#ifndef UAVCAN_LIKELY
# if __GNUC__
# define UAVCAN_LIKELY(x) __builtin_expect(!!(x), true)
# else
# define UAVCAN_LIKELY(x) (x)
# endif
#endif
#ifndef UAVCAN_UNLIKELY
# if __GNUC__
# define UAVCAN_UNLIKELY(x) __builtin_expect(!!(x), false)
# else
# define UAVCAN_UNLIKELY(x) (x)
# endif
#endif
namespace uavcan
{
/**