c_style_pointer_cast.hpp 568 Bytes
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
3
4
#ifndef CK_C_STYLE_POINTER_CAST_HPP
#define CK_C_STYLE_POINTER_CAST_HPP

#include "type.hpp"
Chao Liu's avatar
Chao Liu committed
5
#include "enable_if.hpp"
Chao Liu's avatar
Chao Liu committed
6
7
8
9
10

namespace ck {

template <typename PY,
          typename PX,
Chao Liu's avatar
Chao Liu committed
11
          typename enable_if<is_pointer_v<PY> && is_pointer_v<PX>, bool>::type = false>
Chao Liu's avatar
Chao Liu committed
12
13
14
__host__ __device__ PY c_style_pointer_cast(PX p_x)
{
#pragma clang diagnostic push
Chao Liu's avatar
Chao Liu committed
15
16
17
#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
18
19
20
21
22
#pragma clang diagnostic pop
}

} // namespace ck
#endif