Skip to content

Commit

Permalink
crnlib: implement CRNLIB_ASSUME with static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Jul 10, 2024
1 parent 7746fc1 commit 64e3c3f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions crnlib/crn_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ struct crnlib_assume_failure<true> {
template <int x>
struct crnlib_assume_try {};

#define CRNLIB_JOINER_FINAL(a, b) a##b
#define CRNLIB_JOINER(a, b) CRNLIB_JOINER_FINAL(a, b)
#define CRNLIB_JOIN(a, b) CRNLIB_JOINER(a, b)

#ifdef NDEBUG
#define CRNLIB_ASSUME(p)
#else
#define CRNLIB_ASSUME(p) typedef crnlib_assume_try<sizeof(crnlib_assume_failure<(bool)(p)>)> CRNLIB_JOIN(crnlib_assume_typedef, __COUNTER__)
#endif
#define CRNLIB_ASSUME(p) static_assert(p, "")

#ifdef NDEBUG
template <typename T>
Expand Down

0 comments on commit 64e3c3f

Please sign in to comment.