mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-01 15:56:32 -05:00
99ceb03a1c
This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
21 lines
558 B
C++
21 lines
558 B
C++
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <cstring>
|
|
#include <type_traits>
|
|
|
|
namespace Common {
|
|
|
|
template <typename To, typename From>
|
|
[[nodiscard]] std::enable_if_t<sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> &&
|
|
std::is_trivially_copyable_v<To>,
|
|
To>
|
|
BitCast(const From& src) noexcept {
|
|
To dst;
|
|
std::memcpy(&dst, &src, sizeof(To));
|
|
return dst;
|
|
}
|
|
|
|
} // namespace Common
|