Skip to content

Commit

Permalink
Make popcount function acting on values uniformly callable.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaxyM authored Sep 17, 2024
1 parent 006c331 commit 6f8c024
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/crap/bit.d/popcountvalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "../numbers.d/zero.h"
#include "../numeric.d/iotavalue.h"
#include "../version.d/char8t.h"
#include "../version.d/libintegralconstantcallable.h"
#include "../version.d/unicodecharacters.h"
#endif

Expand Down Expand Up @@ -50,6 +51,9 @@ namespace crap
constexpr const static std :: size_t value = iotaValue <bits, std :: size_t> :: template type <sum> :: value;
using value_type = decltype(value);
constexpr operator value_type () const noexcept;
#if (crap_lib_integral_constant_callable >= 201304L)
constexpr value_type operator () () const noexcept;
#endif
};
#endif
}
Expand All @@ -62,6 +66,15 @@ typename crap :: popcountValue <Type, Value> :: value_type () const noexcept
{
return crap :: popcountValue <Type, Value> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

template <class Type, Type Value>
inline constexpr typename crap :: popcountValue <Type, Value> :: value_type
crap :: popcountValue <Type, Value> :: operator () () const noexcept
{
return crap :: popcountValue <Type, Value> :: value;
}
#endif
#endif
#endif

0 comments on commit 6f8c024

Please sign in to comment.