mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
Rename is necessary, because NEO uses camelCase convention for function names. Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
29 lines
757 B
C++
29 lines
757 B
C++
/*
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <type_traits>
|
|
|
|
namespace NEO {
|
|
template <typename To, typename From>
|
|
constexpr To safePodCast(From *f) {
|
|
typedef typename std::remove_pointer<From>::type FromType;
|
|
typedef typename std::remove_pointer<To>::type ToType;
|
|
|
|
static_assert(std::is_trivially_copyable<FromType>::value &&
|
|
std::is_standard_layout<FromType>::value,
|
|
"Original cast type is not POD");
|
|
|
|
static_assert(std::is_trivially_copyable<ToType>::value &&
|
|
std::is_standard_layout<ToType>::value,
|
|
"Target cast type is not POD");
|
|
|
|
return reinterpret_cast<To>(f);
|
|
}
|
|
} // namespace NEO
|