Files
composable_kernel/include/ck/utility/bit_cast.hpp
2024-07-18 08:37:13 +00:00

20 lines
469 B
C++

// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#include "ck/ck.hpp"
#include "ck/utility/enable_if.hpp"
namespace ck {
template <typename Y, typename X, typename enable_if<sizeof(X) == sizeof(Y), bool>::type = false>
__host__ __device__ constexpr Y bit_cast(const X& x)
{
static_assert(__has_builtin(__builtin_bit_cast), "");
return __builtin_bit_cast(Y, x);
}
} // namespace ck