Skip to content

Commit

Permalink
Hack-fix for compilation errors in coordinates() for shapes created w…
Browse files Browse the repository at this point in the history
…ith of_size() (which uses to_descriptor() - why?).
  • Loading branch information
Domagoj Šarić committed Jul 22, 2023
1 parent fb4f448 commit 76f2aae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/kwk/utility/coordinates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace kwk
{
namespace __ { template <typename T> struct to_int<type_::info<T>> { using type = T; }; }

//================================================================================================
//! @ingroup utility
//! @brief Computes a tuple of coordinates from a linear index and a shape
Expand All @@ -30,7 +32,7 @@ namespace kwk
//================================================================================================
template<std::integral Idx,auto... D>
KWK_CONST constexpr
auto coordinates( Idx const idx, shape<D...> const shp ) noexcept
auto coordinates(Idx const idx, shape<D...> const shp) noexcept
{
KIWAKU_ASSERT ( idx < shp.numel()
, "Converting index " << idx
Expand All @@ -44,9 +46,9 @@ namespace kwk
idx % shp[3],
*/

using coord_t = typename __::largest_integral<__::to_int_t<decltype(D)>...>::type;
return [&]<int... i>(std::integer_sequence<int, i...>)
{
using coord_t = typename __::largest_integral<decltype(D)...>::type;
auto const strides{as_stride(shp)};

return std::array { static_cast<coord_t>( idx / get<0 >(strides) )
Expand Down

0 comments on commit 76f2aae

Please sign in to comment.