Skip to content

Commit

Permalink
Add macros for [[likely]] and [[unlikely]]
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroMemes committed Aug 1, 2024
1 parent fd05dd7 commit f9e2800
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/libhat/Defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,15 @@
#include <type_traits>
#define LIBHAT_IF_CONSTEVAL (std::is_constant_evaluated())
#endif

#if __has_cpp_attribute(likely)
#define LIBHAT_LIKELY [[likely]]
#else
#define LIBHAT_LIKELY
#endif

#if __has_cpp_attribute(unlikely)
#define LIBHAT_UNLIKELY [[unlikely]]
#else
#define LIBHAT_UNLIKELY
#endif

0 comments on commit f9e2800

Please sign in to comment.