Skip to content

Commit

Permalink
Fix: Mark clz and popcount as constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Feb 21, 2024
1 parent 01b5990 commit 212364b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/fastgltf/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ namespace fastgltf {
#if FASTGLTF_HAS_CONCEPTS
requires std::integral<T>
#endif
[[gnu::const]] std::uint8_t clz(T value) {
[[gnu::const]] constexpr std::uint8_t clz(T value) {
static_assert(std::is_integral_v<T>);
#if FASTGLTF_HAS_BIT
return static_cast<std::uint8_t>(std::countl_zero(value));
Expand All @@ -294,7 +294,7 @@ namespace fastgltf {
}

template <typename T>
[[gnu::const]] std::uint8_t popcount(T value) {
[[gnu::const]] constexpr std::uint8_t popcount(T value) {
static_assert(std::is_integral_v<T>);
#if FASTGLTF_HAS_BIT
return static_cast<std::uint8_t>(std::popcount(value));
Expand Down

0 comments on commit 212364b

Please sign in to comment.