Skip to content

Commit 7611542

Browse files
authored
Merge pull request #1514 from GeorgeWeb/georgi/restrict-ur-power-of-2-hepler
[UR] Restrict accepted types for the argument of isPowerOf2 to integral
2 parents 3f5f568 + 02bb629 commit 7611542

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source/ur/ur.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ roundToHighestFactorOfGlobalSize(size_t &ThreadsPerBlockInDim,
336336
}
337337

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

0 commit comments

Comments
 (0)