Commit 3dc20da8 authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Leave the rest byte uninitialized

parent 87eeeac4
...@@ -51,16 +51,17 @@ struct get_carrier<3> ...@@ -51,16 +51,17 @@ struct get_carrier<3>
__device__ inline carrier& operator=(const carrier& other) noexcept __device__ inline carrier& operator=(const carrier& other) noexcept
{ {
std::copy_n(other.bytes.data(), bytes.size(), bytes.data()); std::copy_n(other.bytes.data(), bytes.size(), bytes.data());
return *this; return *this;
} }
__device__ inline operator value_type() const noexcept __device__ inline operator value_type() const noexcept
{ {
value_type value{}; std::array<std::byte, sizeof(value_type)> value;
std::copy_n(bytes.data(), bytes.size(), reinterpret_cast<std::byte*>(&value)); std::copy_n(bytes.data(), bytes.size(), value.data());
return value; return *reinterpret_cast<const value_type*>(value.data());
} }
}; };
}; };
......
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