mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
cdbdf63ebe
This reverts merge request !17
24 lines
440 B
C++
24 lines
440 B
C++
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <version>
|
|
|
|
#ifdef __cpp_lib_bit_cast
|
|
#include <bit>
|
|
#endif
|
|
|
|
namespace Common {
|
|
|
|
template <typename To, typename From>
|
|
constexpr inline To BitCast(const From& from) {
|
|
#ifdef __cpp_lib_bit_cast
|
|
return std::bit_cast<To>(from);
|
|
#else
|
|
return __builtin_bit_cast(To, from);
|
|
#endif
|
|
}
|
|
|
|
} // namespace Common
|