c_style_pointer_cast.hpp 679 Bytes
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
3
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.

Chao Liu's avatar
Chao Liu committed
4
5
6
7
#ifndef CK_C_STYLE_POINTER_CAST_HPP
#define CK_C_STYLE_POINTER_CAST_HPP

#include "type.hpp"
Chao Liu's avatar
Chao Liu committed
8
#include "enable_if.hpp"
Chao Liu's avatar
Chao Liu committed
9
10
11
12
13

namespace ck {

template <typename PY,
          typename PX,
Chao Liu's avatar
Chao Liu committed
14
          typename enable_if<is_pointer_v<PY> && is_pointer_v<PX>, bool>::type = false>
Chao Liu's avatar
Chao Liu committed
15
16
17
__host__ __device__ PY c_style_pointer_cast(PX p_x)
{
#pragma clang diagnostic push
Chao Liu's avatar
Chao Liu committed
18
19
20
#pragma clang diagnostic ignored "-Wold-style-cast"
#pragma clang diagnostic ignored "-Wcast-align"
    return (PY)p_x; // NOLINT(old-style-cast, cast-align)
Chao Liu's avatar
Chao Liu committed
21
22
23
24
25
#pragma clang diagnostic pop
}

} // namespace ck
#endif