diff --git a/include/alpaka/mem/view/ViewAccessOps.hpp b/include/alpaka/mem/view/ViewAccessOps.hpp index 31b7a16e0dca..3ec262d3292a 100644 --- a/include/alpaka/mem/view/ViewAccessOps.hpp +++ b/include/alpaka/mem/view/ViewAccessOps.hpp @@ -1,4 +1,4 @@ -/* Copyright 2022 Andrea Bocci +/* Copyright 2023 Andrea Bocci, Bernhard Manfred Gruber, Jan Stephan * SPDX-License-Identifier: MPL-2.0 */ @@ -8,8 +8,11 @@ #include "alpaka/extent/Traits.hpp" #include "alpaka/mem/view/Traits.hpp" +#include #include +#include #include +#include namespace alpaka::internal { @@ -96,9 +99,12 @@ namespace alpaka::internal std::is_convertible_v, "the index type must be convertible to the index of the Buffer or View"); - auto ptr = reinterpret_cast(data()); + auto ptr = reinterpret_cast(data()); if constexpr(Dim::value > 0) - ptr += (getPitchesInBytes(*static_cast(this)) * castVec(index)).sum(); + { + ptr += static_cast( + (getPitchesInBytes(*static_cast(this)) * castVec(index)).sum()); + } return reinterpret_cast(ptr); }