Updates for 3.4 release. (#1305)
This commit is contained in:
@@ -310,4 +310,17 @@ safe_div(T const& t, U const& u) {
|
||||
return t / u;
|
||||
}
|
||||
|
||||
/**
|
||||
* log2 computation
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
CUTE_HOST_DEVICE constexpr
|
||||
auto
|
||||
log_2(T x) {
|
||||
assert(x > 0);
|
||||
static_assert(is_unsigned<T>::value, "Only to be used for unsigned integral types.");
|
||||
return bit_width(x) - 1;
|
||||
}
|
||||
|
||||
} // namespace cute
|
||||
|
||||
Reference in New Issue
Block a user