c_style_pointer_cast.hpp Source File

c_style_pointer_cast.hpp Source File#

Composable Kernel: c_style_pointer_cast.hpp Source File
c_style_pointer_cast.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
3
4#ifndef CK_C_STYLE_POINTER_CAST_HPP
5#define CK_C_STYLE_POINTER_CAST_HPP
6
7#include "type.hpp"
8#include "enable_if.hpp"
9
10namespace ck {
11
12template <typename PY,
13 typename PX,
14 typename enable_if<is_pointer_v<PY> && is_pointer_v<PX>, bool>::type = false>
15__host__ __device__ PY c_style_pointer_cast(PX p_x)
16{
17#pragma clang diagnostic push
18#pragma clang diagnostic ignored "-Wold-style-cast"
19#pragma clang diagnostic ignored "-Wcast-align"
20 return (PY)p_x; // NOLINT(old-style-cast, cast-align)
21#pragma clang diagnostic pop
22}
23
24} // namespace ck
25#endif
Definition ck.hpp:268
constexpr bool is_pointer_v
Definition type.hpp:303
__host__ __device__ PY c_style_pointer_cast(PX p_x)
Definition c_style_pointer_cast.hpp:15
std::enable_if< B, T > enable_if
Definition enable_if.hpp:24