Skip to content

Commit

Permalink
[UR] Restrict accepted types for the argument of isPowerOf2 to integral
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeWeb committed Apr 15, 2024
1 parent 15233fd commit 02bb629
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/ur/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ roundToHighestFactorOfGlobalSize(size_t &ThreadsPerBlockInDim,
}

// Returns whether or not Value is a power of 2
template <typename T> inline bool isPowerOf2(const T &Value) {
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
bool isPowerOf2(const T &Value) {
return Value && !(Value & (Value - 1));
}

Expand Down

0 comments on commit 02bb629

Please sign in to comment.