Commit 48feb286 authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Rename type trait

parent 85829b33
...@@ -15,28 +15,28 @@ namespace ck { ...@@ -15,28 +15,28 @@ namespace ck {
namespace detail { namespace detail {
template <std::size_t Size> template <std::size_t Size>
struct get_signed_int; struct get_unsigned_int;
template <> template <>
struct get_signed_int<1> struct get_unsigned_int<1>
{ {
using type = std::int8_t; using type = std::uint8_t;
}; };
template <> template <>
struct get_signed_int<2> struct get_unsigned_int<2>
{ {
using type = std::int16_t; using type = std::uint16_t;
}; };
template <> template <>
struct get_signed_int<4> struct get_unsigned_int<4>
{ {
using type = std::int32_t; using type = std::uint32_t;
}; };
template <std::size_t Size> template <std::size_t Size>
using get_signed_int_t = typename get_signed_int<Size>::type; using get_unsigned_int_t = typename get_unsigned_int<Size>::type;
} // namespace detail } // namespace detail
...@@ -53,7 +53,7 @@ __device__ auto readfirstlane(const Object& obj) ...@@ -53,7 +53,7 @@ __device__ auto readfirstlane(const Object& obj)
constexpr std::size_t SgprSize = 4; constexpr std::size_t SgprSize = 4;
constexpr std::size_t ObjectSize = sizeof(Object); constexpr std::size_t ObjectSize = sizeof(Object);
using Sgpr = detail::get_signed_int_t<SgprSize>; using Sgpr = detail::get_unsigned_int_t<SgprSize>;
alignas(Object) std::byte to_obj[ObjectSize]; alignas(Object) std::byte to_obj[ObjectSize];
...@@ -68,7 +68,7 @@ __device__ auto readfirstlane(const Object& obj) ...@@ -68,7 +68,7 @@ __device__ auto readfirstlane(const Object& obj)
if constexpr(0 < RemainedSize) if constexpr(0 < RemainedSize)
{ {
using Carrier = detail::get_signed_int_t<RemainedSize>; using Carrier = detail::get_unsigned_int_t<RemainedSize>;
*reinterpret_cast<Carrier>(to_obj + CompleteSgprCopyBoundary) = *reinterpret_cast<Carrier>(to_obj + CompleteSgprCopyBoundary) =
readfirstlane(*reinterpret_cast<const Carrier*>(from_obj + CompleteSgprCopyBoundary)); readfirstlane(*reinterpret_cast<const Carrier*>(from_obj + CompleteSgprCopyBoundary));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment