MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / log2

Function log2

include/behaviortree_cpp/contrib/magic_enum.hpp:391–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389
390template <typename I>
391constexpr I log2(I value) noexcept {
392 static_assert(std::is_integral_v<I>, "magic_enum::detail::log2 requires integral type.");
393
394 if constexpr (std::is_same_v<I, bool>) { // bool special case
395 return MAGIC_ENUM_ASSERT(false), value;
396 } else {
397 auto ret = I{0};
398 for (; value > I{1}; value >>= I{1}, ++ret) {}
399
400 return ret;
401 }
402}
403
404#if defined(__cpp_lib_array_constexpr) && __cpp_lib_array_constexpr >= 201603L
405# define MAGIC_ENUM_ARRAY_CONSTEXPR 1

Callers 2

is_sparseFunction · 0.85
enum_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected