@@ -31,8 +31,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cute/config.hpp>
|
||||
|
||||
#include <cute/int_tuple.hpp>
|
||||
#include <cute/numeric/int.hpp>
|
||||
#include <cute/numeric/math.hpp>
|
||||
|
||||
namespace cute
|
||||
{
|
||||
@@ -79,8 +80,9 @@ crd2idx_itt(CInt const& coord,
|
||||
return crd2idx(_0{}, get<I0>(shape), get<I0>(stride))
|
||||
+ (_0{} + ... + crd2idx(_0{}, get<Is>(shape), get<Is>(stride)));
|
||||
} else { // General case
|
||||
return crd2idx(coord % product(get<I0>(shape)), get<I0>(shape), get<I0>(stride))
|
||||
+ crd2idx_itt(coord / product(get<I0>(shape)), shape, stride, seq<Is...>{});
|
||||
auto [div, mod] = divmod(coord, product(get<I0>(shape)));
|
||||
return crd2idx(mod, get<I0>(shape), get<I0>(stride))
|
||||
+ crd2idx_itt(div, shape, stride, seq<Is...>{});
|
||||
}
|
||||
|
||||
CUTE_GCC_UNREACHABLE;
|
||||
@@ -229,7 +231,7 @@ idx2crd(Index const& idx,
|
||||
}
|
||||
} else {
|
||||
if constexpr (is_tuple<Shape>::value) { // "int" tuple
|
||||
return idx2crd(idx, shape, compact_col_major(shape));
|
||||
return transform_leaf(as_arithmetic_tuple(crd2idx(idx, shape, make_basis_like(shape))), identity{});
|
||||
} else { // "int" "int"
|
||||
return idx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user